T
- the operations result type.public class AggregateOperation<T> extends java.lang.Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Constructor and Description |
---|
AggregateOperation(MongoNamespace namespace,
java.util.List<BsonDocument> pipeline,
Decoder<T> decoder)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
AggregateOperation<T> |
allowDiskUse(java.lang.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(java.lang.Integer batchSize)
Sets the number of documents to return per batch.
|
AggregateOperation<T> |
collation(Collation collation)
Sets the collation options
|
AggregateOperation<T> |
comment(java.lang.String comment)
Sets the comment to the aggregation.
|
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
|
java.lang.Boolean |
getAllowDiskUse()
Whether writing to temporary files is enabled.
|
java.lang.Integer |
getBatchSize()
Gets the number of documents to return per batch.
|
Collation |
getCollation()
Returns the collation options
|
java.lang.String |
getComment()
Returns the comment to send with the aggregate.
|
BsonDocument |
getHint()
Returns the hint for which index to use.
|
long |
getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor
query.
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
java.util.List<BsonDocument> |
getPipeline()
Gets the aggregation pipeline.
|
ReadConcern |
getReadConcern()
Gets the read concern
|
java.lang.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> |
hint(BsonDocument hint)
Sets the hint for which index to use.
|
AggregateOperation<T> |
maxAwaitTime(long maxAwaitTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.
|
AggregateOperation<T> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
AggregateOperation<T> |
readConcern(ReadConcern readConcern)
Sets the read concern
|
java.lang.String |
toString() |
AggregateOperation<T> |
useCursor(java.lang.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, java.util.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 java.util.List<BsonDocument> getPipeline()
public java.lang.Boolean getAllowDiskUse()
public AggregateOperation<T> allowDiskUse(java.lang.Boolean allowDiskUse)
allowDiskUse
- true if writing to temporary files is enabledpublic java.lang.Integer getBatchSize()
public AggregateOperation<T> batchSize(java.lang.Integer batchSize)
batchSize
- the batch sizepublic long getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
public AggregateOperation<T> maxAwaitTime(long maxAwaitTime, java.util.concurrent.TimeUnit timeUnit)
maxAwaitTime
- the max await time. A value less than one will be ignored, and indicates that the driver should respect the
server's default valuetimeUnit
- the time unit, which may not be nullpublic long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic AggregateOperation<T> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be null@Deprecated public java.lang.Boolean getUseCursor()
@Deprecated public AggregateOperation<T> useCursor(java.lang.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 java.lang.String getComment()
public AggregateOperation<T> comment(java.lang.String comment)
comment
- the commentpublic BsonDocument getHint()
public AggregateOperation<T> hint(BsonDocument hint)
hint
- the hintpublic 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 verbositypublic java.lang.String toString()
toString
in class java.lang.Object