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 public class AggregateOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Deprecated.
An operation that executes an aggregation query.
Since:
3.0
  • Constructor Details

    • 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 Details

    • getPipeline

      public List<BsonDocument> getPipeline()
      Deprecated.
      Gets the aggregation pipeline.
      Returns:
      the 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
    • 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
    • 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
    • batchSize

      public AggregateOperation<T> batchSize(Integer batchSize)
      Deprecated.
      Sets the number of documents to return per batch.
      Parameters:
      batchSize - the batch size
      Returns:
      this
    • 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.
      Parameters:
      timeUnit - the time unit to return the result in
      Returns:
      the maximum await execution time in the given time unit
    • 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 value
      timeUnit - the time unit, which may not be null
      Returns:
      this
    • 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
    • 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 time
      timeUnit - the time unit, which may not be null
      Returns:
      this
    • 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
    • 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
    • getCollation

      public Collation getCollation()
      Deprecated.
      Returns the collation options
      Returns:
      the collation options
      Since:
      3.4
    • collation

      public AggregateOperation<T> collation(Collation collation)
      Deprecated.
      Sets the collation options

      A null value represents the server default.

      Parameters:
      collation - the collation options to use
      Returns:
      this
      Since:
      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
    • 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
    • retryReads

      public AggregateOperation<T> retryReads(boolean retryReads)
      Deprecated.
      Enables retryable reads if a read fails due to a network error.
      Parameters:
      retryReads - true if reads should be retried
      Returns:
      this
      Since:
      3.11
    • getRetryReads

      public boolean getRetryReads()
      Deprecated.
      Gets the value for retryable reads. The default is true.
      Returns:
      the retryable reads value
      Since:
      3.11
    • 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
    • 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
    • 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
    • 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 interface ReadOperation<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 interface AsyncReadOperation<T>
      Parameters:
      binding - the binding to execute in the context of
      callback - 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
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object