Class AggregationOptions

    • Constructor Detail

      • AggregationOptions

        public AggregationOptions()
    • Method Detail

      • prepare

        public <C> com.mongodb.client.MongoCollection<C> prepare​(com.mongodb.client.MongoCollection<C> collection)
        Description copied from interface: dev.morphia.internal.WriteConfigurable
        Applies the options to the collection
        Specified by:
        prepare in interface dev.morphia.internal.ReadConfigurable<AggregationOptions>
        Specified by:
        prepare in interface dev.morphia.internal.WriteConfigurable<AggregationOptions>
        Type Parameters:
        C - the collection type
        Parameters:
        collection - the collection to prepare
        Returns:
        either the passed collection or the updated collection
      • 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.
      • getMaxTime

        public long getMaxTime​(TimeUnit unit)
        Parameters:
        unit - the target unit type
        Returns:
        the configuration value
      • 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
      • 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
      • 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
      • clientSession

        public AggregationOptions clientSession​(com.mongodb.client.ClientSession clientSession)
        Description copied from interface: dev.morphia.internal.SessionConfigurable
        Set the client session to use for the insert.
        Specified by:
        clientSession in interface dev.morphia.internal.SessionConfigurable<AggregationOptions>
        Parameters:
        clientSession - the client session
        Returns:
        this
      • clientSession

        public com.mongodb.client.ClientSession clientSession()
        Description copied from interface: dev.morphia.internal.SessionConfigurable
        The client session to use for the insertion.
        Specified by:
        clientSession in interface dev.morphia.internal.SessionConfigurable<AggregationOptions>
        Returns:
        the client session
      • 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
      • getMaxTimeMS

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

        public com.mongodb.ReadConcern getReadConcern()
        Description copied from interface: dev.morphia.internal.ReadConfigurable
        Gets the read concern
        Specified by:
        getReadConcern in interface dev.morphia.internal.ReadConfigurable<AggregationOptions>
        Returns:
        the configuration value
      • getReadPreference

        public com.mongodb.ReadPreference getReadPreference()
        Specified by:
        getReadPreference in interface dev.morphia.internal.ReadConfigurable<AggregationOptions>
        Returns:
        the configuration value
      • 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
      • readConcern

        public AggregationOptions readConcern​(com.mongodb.ReadConcern readConcern)
        Specifies the read concern.
        Specified by:
        readConcern in interface dev.morphia.internal.ReadConfigurable<AggregationOptions>
        Parameters:
        readConcern - the read concern to use
        Returns:
        this
      • readPreference

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

        public AggregationOptions readPreference​(com.mongodb.ReadPreference readPreference)
        Sets the read preference to use
        Specified by:
        readPreference in interface dev.morphia.internal.ReadConfigurable<AggregationOptions>
        Parameters:
        readPreference - the read preference
        Returns:
        this
      • writeConcern

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

        public AggregationOptions writeConcern​(com.mongodb.WriteConcern writeConcern)
        Sets the write concern to use
        Specified by:
        writeConcern in interface dev.morphia.internal.WriteConfigurable<AggregationOptions>
        Parameters:
        writeConcern - the write concern
        Returns:
        this