Checks whether the given managed document exists in the database.
191997
public function exists(object $document) : bool
    {
        $id = $this->class->getIdentifierObject($document);
        assert($this->collection instanceof Collection);
        return (bool) $this->collection->findOne(['_id' => $id], ['_id']);
    }
474219
def exists(self, primary_key):
        
        '''
            
        '''
        
        select_statement = self.table.select(self.table).where(self.table.c.id==primary_key)
        record_object = self.session.execute(select_statement).first()
        if record_object:
            return True
        return False
1015001
def exists(self, fileDirSpec, **kwargs):
            

            str_path        = self.cwd()
            for k,v in kwargs.items():
                if k == 'path': str_path    = v
            if fileDirSpec in self.lstr_lsnode(str_path):
                return True
            if fileDirSpec in self.lsf(str_path):
                return True
            return False
422447
@Override
  public boolean collectionExists(String collectionName) {
    CollectionMetaData collectionMeta = cmdMap.get(collectionName);
    if(null == collectionMeta) {
      return false;
    }
    collectionMeta.getCollectionLock().readLock().lock();
    try {
      return collectionsRef.get().containsKey(collectionName);
    } finally {
      collectionMeta.getCollectionLock().readLock().unlock();
    }
  }
800619
def exists(self):
        

        if self.driver == 'sqlite' and not os.path.exists(self.path):
            return False

        # init engine
        self.engine

        try:
            # Since we are using the connection, rather than the session, need to
            # explicitly set the search path.

            from sqlalchemy.engine.reflection import Inspector

            inspector = Inspector.from_engine(self.engine)

            if 'config' in inspector.get_table_names(schema=self._schema):
                return True
            else:
                return False
        finally:
            self.close_connection()
1032025
def exists(path, with_expected_db_version=None):
        
        dbmetafile = os.path.join(path, AnchoreImageDB._db_metadata_filename)

        if not os.path.exists(path) or not os.path.exists(dbmetafile):
            return False

        if with_expected_db_version:
            with open(dbmetafile, 'r') as f:
                json_dict = json.load(f)

            if json_dict['anchore_db_version'] != with_expected_db_version:
                return False
        else:
            return True
1034518
public function hasDocument(string $id): bool
    {
        if (isset($this->documents[$id])) {
            return true;
        }

        $path = $this->getDocumentPath($id);

        if ($this->filesystem->has($path)) {
            $info = $this->filesystem->getMetadata($path);

            return $info['type'] === 'file';
        }

        return false;
    }
297844
@Override
    public boolean documentExists(URI documentUri) throws DocumentException {
        URI fileUri = getDocumentInternalUri(documentUri);
        File file = new File(fileUri);
        return file.exists();
    }
1367876
public boolean hasNext() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.next();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
559804
public boolean contains(String id) {
        assertNotEmpty(id, "id");
        InputStream response = null;
        try {
            response = couchDbClient.head(new DatabaseURIHelper(dbUri).documentUri(id));
        } catch (NoDocumentException e) {
            return false;
        } finally {
            close(response);
        }
        return true;
    }
219858
def exists(cls, **kwargs):
        
        if not kwargs:
            raise ValueError(u"`Exists` method requires at least one kwarg.")

        # special case to check for a simple pk
        if len(kwargs) == 1 and cls._field_is_pk(list(kwargs.keys())[0]):
            return cls.get_field('pk').exists(list(kwargs.values())[0])

        # get only the first element of the unsorted collection (the fastest)
        try:
            cls.collection(**kwargs).sort(by='nosort')[0]
        except IndexError:
            return False
        else:
            return True
327370
def schema_exists(cls, cur, schema_name):
        
        cur.execute("SELECT EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = '{0}');"
                    .format(schema_name))
        return cur.fetchone()[0]
791618
def user_exists(name, user=None, password=None, host=None, port=None,
                database='admin', authdb=None):
    '''
    
    '''
    users = user_list(user, password, host, port, database, authdb)

    if isinstance(users, six.string_types):
        return 'Failed to connect to mongo database'

    for user in users:
        if name == dict(user).get('user'):
            return True

    return False
592738
function isFiltered(doc, filter, db) {
  try {
    return !!(filter && !filter(doc));
  } catch (e) {
    db.emit('error', e);
    return true;
  }
}
104775
def exists(self, value=None):
        
        try:
            if not value:
                value = self.get()
        except (AttributeError, DoesNotExist):
            # If the instance is deleted, the _pk attribute doesn't exist
            # anymore. So we catch the AttributeError to return False (this pk
            # field doesn't exist anymore) in this specific case
            return False
        else:
            return self.connection.sismember(self.collection_key, value)
45049
def exists(self, index, doc_type, id, **query_params):
        
        path = make_path(index, doc_type, id)
        return self._send_request('HEAD', path, params=query_params)
1096606
def has_model(self, name):
        
        return self.es.exists(index=self.index_name,
                              doc_type=self.DOC_TYPE, id=name)