T - the operations result type.public class AggregateOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
| Constructor and Description |
|---|
AggregateOperation(MongoNamespace namespace,
List<BsonDocument> pipeline,
Decoder<T> decoder)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
AggregateOperation<T> |
allowDiskUse(Boolean allowDiskUse)
Enables writing to temporary files.
|
ReadOperation<BsonDocument> |
asExplainableOperation(ExplainVerbosity explainVerbosity)
Gets an operation whose execution explains this operation.
|
AsyncReadOperation<BsonDocument> |
asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Gets an operation whose execution explains this operation.
|
AggregateOperation<T> |
batchSize(Integer batchSize)
Sets the number of documents to return per batch.
|
AggregateOperation<T> |
collation(Collation collation)
Sets the collation options
|
BatchCursor<T> |
execute(ReadBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<AsyncBatchCursor<T>> callback)
General execute which can return anything of type T
|
Boolean |
getAllowDiskUse()
Whether writing to temporary files is enabled.
|
Integer |
getBatchSize()
Gets the number of documents to return per batch.
|
Collation |
getCollation()
Returns the collation options
|
long |
getMaxTime(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
List<BsonDocument> |
getPipeline()
Gets the aggregation pipeline.
|
ReadConcern |
getReadConcern()
Gets the read concern
|
Boolean |
getUseCursor()
Gets whether the server should use a cursor to return results.
|
AggregateOperation<T> |
maxTime(long maxTime,
TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
AggregateOperation<T> |
readConcern(ReadConcern readConcern)
Sets the read concern
|
AggregateOperation<T> |
useCursor(Boolean useCursor)
Sets whether the server should use a cursor to return results.
|
public AggregateOperation(MongoNamespace namespace, List<BsonDocument> pipeline, Decoder<T> decoder)
namespace - the database and collection namespace for the operation.pipeline - the aggregation pipeline.decoder - the decoder for the result documents.public List<BsonDocument> getPipeline()
public Boolean getAllowDiskUse()
public AggregateOperation<T> allowDiskUse(Boolean allowDiskUse)
allowDiskUse - true if writing to temporary files is enabledpublic Integer getBatchSize()
public AggregateOperation<T> batchSize(Integer batchSize)
batchSize - the batch sizepublic long getMaxTime(TimeUnit timeUnit)
timeUnit - the time unit to return the result inpublic AggregateOperation<T> maxTime(long maxTime, TimeUnit timeUnit)
maxTime - the max timetimeUnit - the time unit, which may not be nullpublic Boolean getUseCursor()
public AggregateOperation<T> useCursor(Boolean useCursor)
useCursor - whether the server should use a cursor to return resultspublic ReadConcern getReadConcern()
public AggregateOperation<T> readConcern(ReadConcern readConcern)
readConcern - the read concernpublic Collation getCollation()
public AggregateOperation<T> collation(Collation collation)
A null value represents the server default.
collation - the collation options to usepublic BatchCursor<T> execute(ReadBinding binding)
ReadOperationexecute in interface ReadOperation<BatchCursor<T>>binding - the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperationexecuteAsync in interface AsyncReadOperation<AsyncBatchCursor<T>>binding - the binding to execute in the context ofcallback - the callback to be called when the operation has been executedpublic ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
explainVerbosity - the explain verbositypublic AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
explainVerbosity - the explain verbosity