use of com.mongodb.internal.operation.MapReduceBatchCursor in project mongo-java-driver by mongodb.
the class MapReduceIterableImpl method asReadOperation.
@Override
public ReadOperation<BatchCursor<TResult>> asReadOperation() {
if (inline) {
ReadOperation<MapReduceBatchCursor<TResult>> operation = operations.mapReduce(mapFunction, reduceFunction, finalizeFunction, resultClass, filter, limit, maxTimeMS, jsMode, scope, sort, verbose, collation);
return new WrappedMapReduceReadOperation<TResult>(operation);
} else {
getExecutor().execute(createMapReduceToCollectionOperation(), getReadConcern(), getClientSession());
String dbName = databaseName != null ? databaseName : namespace.getDatabaseName();
FindOptions findOptions = new FindOptions().collation(collation);
Integer batchSize = getBatchSize();
if (batchSize != null) {
findOptions.batchSize(batchSize);
}
return operations.find(new MongoNamespace(dbName, collectionName), new BsonDocument(), resultClass, findOptions);
}
}
Aggregations