Search in sources :

Example 1 with QueryResult

use of com.mongodb.connection.QueryResult in project mongo-java-driver by mongodb.

the class OperationHelper method cursorDocumentToQueryResult.

private static <T> QueryResult<T> cursorDocumentToQueryResult(final BsonDocument cursorDocument, final ServerAddress serverAddress, final String fieldNameContainingBatch) {
    long cursorId = ((BsonInt64) cursorDocument.get("id")).getValue();
    MongoNamespace queryResultNamespace = new MongoNamespace(cursorDocument.getString("ns").getValue());
    return new QueryResult<T>(queryResultNamespace, BsonDocumentWrapperHelper.<T>toList(cursorDocument, fieldNameContainingBatch), cursorId, serverAddress);
}
Also used : BsonInt64(org.bson.BsonInt64) QueryResult(com.mongodb.connection.QueryResult) MongoNamespace(com.mongodb.MongoNamespace)

Aggregations

MongoNamespace (com.mongodb.MongoNamespace)1 QueryResult (com.mongodb.connection.QueryResult)1 BsonInt64 (org.bson.BsonInt64)1