org.springframework.data.mongodb.core.aggregation

Class AggregationOptions

  • java.lang.Object
    • org.springframework.data.mongodb.core.aggregation.AggregationOptions


  • public class AggregationOptions
    extends Object
    Holds a set of configurable aggregation options that can be used within an aggregation pipeline. A list of support aggregation options can be found in the MongoDB reference documentation https://docs.mongodb.org/manual/reference/command/aggregate/#aggregate
    Since:
    1.6
    Author:
    Thomas Darimont, Oliver Gierke, Christoph Strobl, Mark Paluch
    See Also:
    Aggregation.withOptions(AggregationOptions), TypedAggregation.withOptions(AggregationOptions)
    • Constructor Detail

      • AggregationOptions

        public AggregationOptions(boolean allowDiskUse,
                                  boolean explain,
                                  org.bson.Document cursor)
        Creates a new AggregationOptions.
        Parameters:
        allowDiskUse - whether to off-load intensive sort-operations to disk.
        explain - whether to get the execution plan for the aggregation instead of the actual results.
        cursor - can be null, used to pass additional options to the aggregation.
      • AggregationOptions

        public AggregationOptions(boolean allowDiskUse,
                                  boolean explain,
                                  @Nullable
                                  org.bson.Document cursor,
                                  @Nullable
                                  Collation collation)
        Creates a new AggregationOptions.
        Parameters:
        allowDiskUse - whether to off-load intensive sort-operations to disk.
        explain - whether to get the execution plan for the aggregation instead of the actual results.
        cursor - can be null, used to pass additional options (such as batchSize) to the aggregation.
        collation - collation for string comparison. Can be null.
        Since:
        2.0
      • AggregationOptions

        public AggregationOptions(boolean allowDiskUse,
                                  boolean explain,
                                  int cursorBatchSize)
        Creates a new AggregationOptions.
        Parameters:
        allowDiskUse - whether to off-load intensive sort-operations to disk.
        explain - whether to get the execution plan for the aggregation instead of the actual results.
        cursorBatchSize - initial cursor batch size.
        Since:
        2.0
    • Method Detail

      • isAllowDiskUse

        public boolean isAllowDiskUse()
        Enables writing to temporary files. When set to true, aggregation stages can write data to the _tmp subdirectory in the dbPath directory.
        Returns:
      • isExplain

        public boolean isExplain()
        Specifies to return the information on the processing of the pipeline.
        Returns:
      • getCursorBatchSize

        @Nullable
        public Integer getCursorBatchSize()
        The initial cursor batch size, if available, otherwise null.
        Returns:
        the batch size or null.
        Since:
        2.0
      • getCursor

        public Optional<org.bson.Document> getCursor()
        Specify a document that contains options that control the creation of the cursor object.
        Returns:
      • getCollation

        public Optional<Collation> getCollation()
        Get collation settings for string comparison.
        Returns:
        Since:
        2.0
      • toDocument

        public org.bson.Document toDocument()
        Returns a Document representation of this AggregationOptions.
        Returns: