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()
Deprecated.
There is no replacement for this. Applications can assume that the driver will use a cursor for server versions
that support it (>= 2.6). The driver will ignore this as of MongoDB 3.6, which does not support inline results for the aggregate
command.
|
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)
Deprecated.
There is no replacement for this. Applications can assume that the driver will use a cursor for server versions
that support it (>= 2.6). The driver will ignore this as of MongoDB 3.6, which does not support inline results for the aggregate
command.
|
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 null@Deprecated public Boolean getUseCursor()
@Deprecated 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)
ReadOperation
execute
in interface ReadOperation<BatchCursor<T>>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperation
executeAsync
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