Class AggregationOptions

    • Constructor Detail

      • AggregationOptions

        public AggregationOptions()
    • Method Detail

      • allowDiskUse

        public boolean allowDiskUse()
        Returns:
        the configuration value
      • allowDiskUse

        public AggregationOptions allowDiskUse​(boolean allowDiskUse)
        Enables writing to temporary files.
        Parameters:
        allowDiskUse - true to enable
        Returns:
        this
      • apply

        public <S,​T> com.mongodb.client.AggregateIterable<S> apply​(List<org.bson.Document> documents,
                                                                         com.mongodb.client.MongoCollection<T> collection,
                                                                         Class<S> resultType)
        Applies the configured options to the collection.
        Type Parameters:
        T - the collection type
        S - the result type
        Parameters:
        documents - the stage documents
        collection - the collection to configure
        resultType - the result type
        Returns:
        the updated collection
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • batchSize

        public int batchSize()
        Returns:
        the configuration value
      • batchSize

        public AggregationOptions batchSize​(int batchSize)
        Sets the batch size for fetching results.
        Parameters:
        batchSize - the size
        Returns:
        this
      • bypassDocumentValidation

        public boolean bypassDocumentValidation()
        Returns:
        the configuration value
      • bypassDocumentValidation

        public AggregationOptions bypassDocumentValidation​(boolean bypassDocumentValidation)
        Enables the aggregation to bypass document validation during the operation. This lets you insert documents that do not meet the validation requirements.

        Applicable only if you specify the $out or $merge aggregation stages.

        Parameters:
        bypassDocumentValidation - true to enable the bypass
        Returns:
        this
      • collation

        public com.mongodb.client.model.Collation collation()
        Returns:
        the configuration value
      • collation

        public AggregationOptions collation​(com.mongodb.client.model.Collation collation)
        Specifies the collation to use for the operation.

        Collation allows users to specify language-specific rules for string comparison, such as rules for letter case and accent marks.

        Parameters:
        collation - the collation to use
        Returns:
        this
      • getAllowDiskUse

        public boolean getAllowDiskUse()
        Returns:
        the configuration value
      • getBatchSize

        public int getBatchSize()
        Returns:
        the configuration value
      • getBypassDocumentValidation

        public boolean getBypassDocumentValidation()
        Returns:
        the configuration value
      • getCollation

        public com.mongodb.client.model.Collation getCollation()
        Returns:
        the configuration value
      • getMaxTime

        public long getMaxTime​(TimeUnit unit)
        Parameters:
        unit - the target unit type
        Returns:
        the configuration value
      • getMaxTimeMS

        public long getMaxTimeMS()
        Returns:
        the configuration value
      • hint

        public org.bson.Document hint()
        Returns:
        the hint for which index to use. A null value means no hint is set.
        Since:
        2.0
        Since server release
        3.6
      • hint

        public AggregationOptions hint​(String hint)
        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
      • prepare

        public <C> com.mongodb.client.MongoCollection<C> prepare​(com.mongodb.client.MongoCollection<C> collection)
        Description copied from interface: WriteConfigurable
        Applies the options to the collection
        Specified by:
        prepare in interface ReadConfigurable<AggregationOptions>
        Specified by:
        prepare in interface WriteConfigurable<AggregationOptions>
        Type Parameters:
        C - the collection type
        Parameters:
        collection - the collection to prepare
        Returns:
        either the passed collection or the updated collection
      • maxTimeMS

        public long maxTimeMS()
        Returns:
        the configuration value
      • maxTimeMS

        public AggregationOptions maxTimeMS​(long maxTimeMS)
        Specifies a time limit in milliseconds for processing operations on a cursor. If you do not specify a value for maxTimeMS, operations will not time out. A value of 0 explicitly specifies the default unbounded behavior.
        Parameters:
        maxTimeMS - the max time in milliseconds
        Returns:
        this
      • readConcern

        public com.mongodb.ReadConcern readConcern()
        Returns:
        the configuration value
      • readPreference

        public com.mongodb.ReadPreference readPreference()
        Returns:
        the configuration value
      • writeConcern

        @Nullable
        public com.mongodb.WriteConcern writeConcern()
        Description copied from interface: WriteConfigurable
        The write concern to use. By default the write concern configured for the MongoCollection instance will be used.
        Specified by:
        writeConcern in interface WriteConfigurable<AggregationOptions>
        Returns:
        the configuration value