Package com.mongodb

Class AggregationOptions



  • public class AggregationOptions
    extends java.lang.Object
    The options to apply to an aggregate operation.
    Since:
    2.12
    MongoDB documentation
    aggregate
    Since server release
    2.2
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AggregationOptions.Builder
      Builder for creating AggregationOptions.
      static class  AggregationOptions.OutputMode
      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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static AggregationOptions.Builder builder​()
      Creates a new Builder for AggregationOptions.
      java.lang.Boolean getAllowDiskUse​()
      If true, this enables external sort capabilities, otherwise $sort produces an error if the operation consumes 10 percent or more of RAM.
      java.lang.Integer getBatchSize​()
      The size of batches to use when iterating over results.
      java.lang.Boolean getBypassDocumentValidation​()
      Gets whether to bypass document validation, or null if unspecified.
      Collation getCollation​()
      Returns the collation options
      long getMaxTime​(java.util.concurrent.TimeUnit timeUnit)
      Gets the maximum execution time for the aggregation command.
      AggregationOptions.OutputMode getOutputMode​()
      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.
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getAllowDiskUse

        public java.lang.Boolean getAllowDiskUse​()
        If true, this enables external sort capabilities, otherwise $sort produces an error if the operation consumes 10 percent or more of RAM.
        Returns:
        true if aggregation stages can write data to temporary files
        Since server release
        2.6
      • getBatchSize

        public java.lang.Integer getBatchSize​()
        The size of batches to use when iterating over results.
        Returns:
        the batch size
        Since server release
        2.6
      • getOutputMode

        @Deprecated
        public AggregationOptions.OutputMode getOutputMode​()
        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.
        The mode of output for this configuration.
        Returns:
        whether the output will be inline or via a cursor, which defaults to AggregationOptions.OutputMode.CURSOR
        See Also:
        AggregationOptions.OutputMode
      • getMaxTime

        public long getMaxTime​(java.util.concurrent.TimeUnit timeUnit)
        Gets the maximum execution time for the aggregation command.
        Parameters:
        timeUnit - the time unit for the result
        Returns:
        the max time
        Since:
        2.12
        Since server release
        2.6
      • getBypassDocumentValidation

        public java.lang.Boolean getBypassDocumentValidation​()
        Gets whether to bypass document validation, or null if unspecified. The default is null.
        Returns:
        whether to bypass document validation, or null if unspecified.
        Since:
        2.14
        Since server release
        3.2
      • getCollation

        public Collation getCollation​()
        Returns the collation options
        Returns:
        the collation options
        Since:
        3.4
        Since server release
        3.4
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object
      • builder

        public static AggregationOptions.Builder builder​()
        Creates a new Builder for AggregationOptions.
        Returns:
        a new empty builder.