Package com.mongodb.operation
Class AggregateOperation<T>
- java.lang.Object
-
- com.mongodb.operation.AggregateOperation<T>
-
- Type Parameters:
T
- the operations result type.
- All Implemented Interfaces:
AsyncReadOperation<AsyncBatchCursor<T>>
,ReadOperation<BatchCursor<T>>
Deprecated.
@Deprecated public class AggregateOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
An operation that executes an aggregation query.- Since:
- 3.0
- MongoDB documentation
- Aggregation
- Since server release
- 2.2
-
-
Constructor Summary
Constructors Constructor Description AggregateOperation(MongoNamespace namespace, List<BsonDocument> pipeline, Decoder<T> decoder)
Deprecated.Construct a new instance.AggregateOperation(MongoNamespace namespace, List<BsonDocument> pipeline, Decoder<T> decoder, AggregationLevel aggregationLevel)
Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AggregateOperation<T>
allowDiskUse(Boolean allowDiskUse)
Deprecated.Enables writing to temporary files.ReadOperation<BsonDocument>
asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.AsyncReadOperation<BsonDocument>
asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.AggregateOperation<T>
batchSize(Integer batchSize)
Deprecated.Sets the number of documents to return per batch.AggregateOperation<T>
collation(Collation collation)
Deprecated.Sets the collation optionsAggregateOperation<T>
comment(String comment)
Deprecated.Sets the comment to the aggregation.BatchCursor<T>
execute(ReadBinding binding)
Deprecated.General execute which can return anything of type Tvoid
executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
Deprecated.General execute which can return anything of type TBoolean
getAllowDiskUse()
Deprecated.Whether writing to temporary files is enabled.Integer
getBatchSize()
Deprecated.Gets the number of documents to return per batch.Collation
getCollation()
Deprecated.Returns the collation optionsString
getComment()
Deprecated.Returns the comment to send with the aggregate.BsonDocument
getHint()
Deprecated.Returns the hint for which index to use.BsonValue
getHintBsonValue()
Deprecated.Returns the hint BsonValue for which index to use.long
getMaxAwaitTime(TimeUnit timeUnit)
Deprecated.The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.long
getMaxTime(TimeUnit timeUnit)
Deprecated.Gets the maximum execution time on the server for this operation.List<BsonDocument>
getPipeline()
Deprecated.Gets the aggregation pipeline.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(BsonValue hint)
Deprecated.Sets the hint for which index to use.AggregateOperation<T>
maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
Deprecated.Sets the maximum await execution time on the server for this operation.AggregateOperation<T>
maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.Sets the maximum execution time on the server for this operation.String
toString()
Deprecated.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.
-
-
-
Constructor Detail
-
AggregateOperation
public AggregateOperation(MongoNamespace namespace, List<BsonDocument> pipeline, Decoder<T> decoder)
Deprecated.Construct a new instance.- Parameters:
namespace
- the database and collection namespace for the operation.pipeline
- the aggregation pipeline.decoder
- the decoder for the result documents.
-
AggregateOperation
public AggregateOperation(MongoNamespace namespace, List<BsonDocument> pipeline, Decoder<T> decoder, AggregationLevel aggregationLevel)
Deprecated.Construct a new instance.- Parameters:
namespace
- the database and collection namespace for the operation.pipeline
- the aggregation pipeline.decoder
- the decoder for the result documents.aggregationLevel
- the aggregation level- Since:
- 3.10
-
-
Method Detail
-
getPipeline
public List<BsonDocument> getPipeline()
Deprecated.Gets the aggregation pipeline.- Returns:
- the pipeline
- MongoDB documentation
- Aggregation Pipeline
-
getAllowDiskUse
public Boolean getAllowDiskUse()
Deprecated.Whether writing to temporary files is enabled. A null value indicates that it's unspecified.- Returns:
- true if writing to temporary files is enabled
- MongoDB documentation
- Aggregation
- Since server release
- 2.6
-
allowDiskUse
public AggregateOperation<T> allowDiskUse(Boolean allowDiskUse)
Deprecated.Enables writing to temporary files. A null value indicates that it's unspecified.- Parameters:
allowDiskUse
- true if writing to temporary files is enabled- Returns:
- this
- MongoDB documentation
- Aggregation
- Since server release
- 2.6
-
getBatchSize
public Integer getBatchSize()
Deprecated.Gets the number of documents to return per batch. Default to 0, which indicates that the server chooses an appropriate batch size.- Returns:
- the batch size, which may be null
- MongoDB documentation
- Batch Size
-
batchSize
public AggregateOperation<T> batchSize(Integer batchSize)
Deprecated.Sets the number of documents to return per batch.- Parameters:
batchSize
- the batch size- Returns:
- this
- MongoDB documentation
- Batch Size
-
getMaxAwaitTime
public long getMaxAwaitTime(TimeUnit timeUnit)
Deprecated.The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored. A zero value will be ignored.
-
maxAwaitTime
public AggregateOperation<T> maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
Deprecated.Sets the maximum await execution time on the server for this operation.- Parameters:
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 null- Returns:
- this
- Since server release
- 3.6
-
getMaxTime
public long getMaxTime(TimeUnit timeUnit)
Deprecated.Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
- MongoDB documentation
- Max Time
-
maxTime
public AggregateOperation<T> maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max timetimeUnit
- the time unit, which may not be null- Returns:
- this
- MongoDB documentation
- Max Time
-
getUseCursor
@Deprecated public 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.Gets whether the server should use a cursor to return results. The default value is null, in which case a cursor will be used if the server supports it.- Returns:
- whether the server should use a cursor to return results
- MongoDB documentation
- Aggregation
- Since server release
- 2.6
-
useCursor
@Deprecated public 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.Sets whether the server should use a cursor to return results.- Parameters:
useCursor
- whether the server should use a cursor to return results- Returns:
- this
- MongoDB documentation
- Aggregation
- Since server release
- 2.6
-
getCollation
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- MongoDB documentation
- Aggregation
- Since server release
- 3.4
-
collation
public AggregateOperation<T> collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
- MongoDB documentation
- Aggregation
- Since server release
- 3.4
-
getComment
public String getComment()
Deprecated.Returns the comment to send with the aggregate. The default is not to include a comment with the aggregation.- Returns:
- the comment
- Since:
- 3.6
- Since server release
- 3.6
-
comment
public AggregateOperation<T> comment(String comment)
Deprecated.Sets the comment to the aggregation. A null value means no comment is set.- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 3.6
- Since server release
- 3.6
-
getHint
public BsonDocument getHint()
Deprecated.Returns the hint for which index to use. The default is not to set a hint.- Returns:
- the hint
- Since:
- 3.6
- Since server release
- 3.6
-
getHintBsonValue
public BsonValue getHintBsonValue()
Deprecated.Returns the hint BsonValue for which index to use. The default is not to set a hint.Hints can either be a BsonString or a BsonDocument.
- Returns:
- the hint
- Since:
- 3.8
- Since server release
- 3.6
-
hint
public AggregateOperation<T> hint(BsonValue hint)
Deprecated.Sets the hint for which index to use. A null value means no hint is set.- Parameters:
hint
- the hint- Returns:
- this
- Since:
- 3.6
- Since server release
- 3.6
-
execute
public BatchCursor<T> execute(ReadBinding binding)
Deprecated.Description copied from interface:ReadOperation
General execute which can return anything of type T- Specified by:
execute
in interfaceReadOperation<T>
- Parameters:
binding
- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
Deprecated.Description copied from interface:AsyncReadOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncReadOperation<T>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
asExplainableOperation
public ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
asExplainableOperationAsync
public AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
-