Get a single document from the database.
554024
def find_one(self, *args, **kwargs):
        
        doc = self._collection_with_options(kwargs).find_one(*args, **kwargs)
        if doc is None:
            return None

        return doc
1292859
def get_single_payload(self, query_obj):
        """"""
        payload = self.get_df_payload(query_obj)
        df = payload.get('df')
        status = payload.get('status')
        if status != utils.QueryStatus.FAILED:
            if df is not None and df.empty:
                payload['error'] = 'No data'
            else:
                payload['data'] = self.get_data(df)
        if 'df' in payload:
            del payload['df']
        return payload
473262
def get_document(id, index=INDEX_NAME, doc_type=DOC_TYPE, **kwargs):
    
    result = es_conn.get(index=index, doc_type=doc_type, id=id, **kwargs)
    return result['_source']
452257
function(model, db, options) {
		// a single model
		if (!isCollection(model)) return db.get(model.id, options.options.get);

		// process query requests
		if (options.query) return db.query(options.query, options.options.query);

		// regular collection fetch
		return db.allDocs(options.options.allDocs);
	}
1300430
def get(self, id):
        """"""
        params = {'q': 'id:%s' % str(id), 'wt': 'python'}
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data['response']['numFound'] > 0:
            return data['response']['docs'][0]
        return None
1106041
def get_one(table: LdapObjectClass, query: Optional[Q] = None,
            database: Optional[Database] = None, base_dn: Optional[str] = None) -> LdapObject:
    
    results = search(table, query, database, base_dn)

    try:
        result = next(results)
    except StopIteration:
        raise ObjectDoesNotExist(f"Cannot find result for {query}.")

    try:
        next(results)
        raise MultipleObjectsReturned(f"Found multiple results for {query}.")
    except StopIteration:
        pass

    return result
250120
def get_collection(self, collection, **kwargs):
        
        query = kwargs.get('query', {})
        projection = kwargs.get('projection', {})
        projection = None if len(projection) < 1 else projection
        limit = kwargs.get('limit', 0)  # no limit by default
        # sort = kwargs.get('sort', {})
        logging.info("About to get a collection from the database")
        logging.debug("Collection: {}".format(collection))
        logging.debug("Query: {}".format(query))
        logging.debug("Projection: {}".format(projection))
        logging.debug("Limit: {}".format(limit))
        records = \
            list(self.db[collection].find(query, projection).limit(limit))
        logging.debug("Got {} results".format(len(records)))
        return records
51921
def get_doc(self, objtxt):
        """"""
        obj, valid = self._eval(objtxt)
        if valid:
            return getdoc(obj)
749923
def get_one(self, key):
        
        query = {'_id': ObjectId(key)}
        collection = self.ds.connection(COLLECTION_UNIT_OF_WORK)

        document = collection.find_one(query)
        if document is None:
            msg = 'UOW with ID={0} was not found'.format(key)
            self.logger.warning(msg)
            raise LookupError(msg)
        return UnitOfWork.from_json(document)
368881
@Override
	public T get(X primaryID) {
		if(primaryID == null) {
			return null;
		}
		
		T dbObject = this.mongoTemplate.findById(primaryID, this.entityClass);
		return dbObject;
	}
620781
def get_one(self, schema, query=None, **kwargs):
        
        ret = self._get_query(self._get_one, schema, query, **kwargs)
        if not ret: ret = {}
        return ret
493700
public int getDocId(String url) {
        synchronized (mutex) {
            OperationStatus result = null;
            DatabaseEntry value = new DatabaseEntry();
            try {
                DatabaseEntry key = new DatabaseEntry(url.getBytes());
                result = docIDsDB.get(null, key, value, null);

            } catch (RuntimeException e) {
                if (config.isHaltOnError()) {
                    throw e;
                } else {
                    logger.error("Exception thrown while getting DocID", e);
                    return -1;
                }
            }

            if ((result == OperationStatus.SUCCESS) && (value.getData().length > 0)) {
                return Util.byteArray2Int(value.getData());
            }

            return -1;
        }
    }
717397
@InterfaceAudience.Public
    public Document getDocument() {
        if (getDocumentId() == null) {
            return null;
        }
        assert (database != null);
        Document document = database.getDocument(getDocumentId());
        document.loadCurrentRevisionFrom(this);
        return document;
    }
728526
def get_object(self, id, **args):
        """"""
        return self.request("{0}/{1}".format(self.version, id), args)
215041
def get_db(cls):
        """"""
        if cls._db:
            return getattr(cls._client, cls._db)
        return cls._client.get_default_database()
231124
@Override
    public DesignDocument getFromDatabase(CouchDbConnector db, String designDocumentId) {
    	return db.get(DesignDocument.class, designDocumentId);
    }
163172
def get(cls, id_):
        """"""
        with db.session.no_autoflush:
            query = cls.dbmodel.query.filter_by(id=id_)
            try:
                model = query.one()
            except NoResultFound:
                raise WorkflowsMissingObject("No object for for id {0}".format(
                    id_
                ))
            return cls(model)