Class AggregateOptions


  • public class AggregateOptions
    extends Object
    Configures the aggregate streams.
    • Constructor Detail

      • AggregateOptions

        public AggregateOptions()
    • Method Detail

      • allowDiskUse

        public AggregateOptions allowDiskUse​(boolean allowDiskUse)
        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
      • maxTime

        public AggregateOptions maxTime​(long maxTime,
                                        TimeUnit timeUnit)
        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
      • maxAwaitTime

        public AggregateOptions maxAwaitTime​(long maxAwaitTime,
                                             TimeUnit timeUnit)
        The maximum amount of time for the server to wait on new documents to satisfy a $changeStream aggregation.

        A zero value will be ignored.

        Parameters:
        maxAwaitTime - the max await time
        timeUnit - the time unit to return the result in
        Returns:
        the maximum await execution time in the given time unit
      • bypassDocumentValidation

        public AggregateOptions bypassDocumentValidation​(boolean bypassDocumentValidation)
        Sets the bypass document level validation flag.

        Note: This only applies when an $out stage is specified

        .
        Parameters:
        bypassDocumentValidation - If true, allows the write to opt-out of document level validation.
        Returns:
        this
      • collation

        public AggregateOptions collation​(com.mongodb.client.model.Collation collation)
        Sets the collation options

        A null value represents the server default.

        Parameters:
        collation - the collation options to use
        Returns:
        this
      • comment

        public AggregateOptions comment​(String comment)
        Sets the comment to the aggregation. A null value means no comment is set.
        Parameters:
        comment - the comment
        Returns:
        this
      • hint

        public AggregateOptions hint​(org.bson.conversions.Bson hint)
        Sets the hint for which index to use. A null value means no hint is set.
        Parameters:
        hint - the hint
        Returns:
        this
      • batchSize

        public AggregateOptions batchSize​(int size)
        Sets the number of documents to return per batch.

        Overrides the Subscription.request(long) value for setting the batch size, allowing for fine grained control over the underlying cursor.

        Parameters:
        size - the batch size
        Returns:
        this
      • apply

        public <T> com.mongodb.reactivestreams.client.AggregatePublisher<T> apply​(com.mongodb.reactivestreams.client.AggregatePublisher<T> stream)