use of com.mongodb.internal.client.model.FindOptions in project mongo-java-driver by mongodb.
the class AggregatePublisherImpl method asAsyncReadOperation.
@Override
AsyncReadOperation<AsyncBatchCursor<T>> asAsyncReadOperation(final int initialBatchSize) {
MongoNamespace outNamespace = getOutNamespace();
if (outNamespace != null) {
AsyncReadOperation<Void> aggregateToCollectionOperation = getAggregateToCollectionOperation();
FindOptions findOptions = new FindOptions().collation(collation).batchSize(initialBatchSize);
AsyncReadOperation<AsyncBatchCursor<T>> findOperation = getOperations().find(outNamespace, new BsonDocument(), getDocumentClass(), findOptions);
return new VoidReadOperationThenCursorReadOperation<>(aggregateToCollectionOperation, findOperation);
} else {
return asAggregateOperation(initialBatchSize);
}
}
use of com.mongodb.internal.client.model.FindOptions 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);
}
}
use of com.mongodb.internal.client.model.FindOptions in project mongo-java-driver by mongodb.
the class AggregateIterableImpl method asReadOperation.
@Override
public ReadOperation<BatchCursor<TResult>> asReadOperation() {
MongoNamespace outNamespace = getOutNamespace();
if (outNamespace != null) {
getExecutor().execute(operations.aggregateToCollection(pipeline, maxTimeMS, allowDiskUse, bypassDocumentValidation, collation, hint, hintString, comment, variables, aggregationLevel), getReadPreference(), getReadConcern(), getClientSession());
FindOptions findOptions = new FindOptions().collation(collation);
Integer batchSize = getBatchSize();
if (batchSize != null) {
findOptions.batchSize(batchSize);
}
return operations.find(outNamespace, new BsonDocument(), resultClass, findOptions);
} else {
return asAggregateOperation();
}
}
use of com.mongodb.internal.client.model.FindOptions in project mongo-java-driver by mongodb.
the class MapReducePublisherImpl method createFindOperation.
private AsyncReadOperation<AsyncBatchCursor<T>> createFindOperation(final int initialBatchSize) {
String dbName = databaseName != null ? databaseName : getNamespace().getDatabaseName();
FindOptions findOptions = new FindOptions().collation(collation).batchSize(initialBatchSize);
return getOperations().find(new MongoNamespace(dbName, collectionName), new BsonDocument(), getDocumentClass(), findOptions);
}
Aggregations