Package dev.morphia

Class FindAndModifyOptions


  • public final class FindAndModifyOptions
    extends java.lang.Object
    The options for find and modify operations.
    Since:
    1.3
    • Constructor Detail

      • FindAndModifyOptions

        public FindAndModifyOptions()
        Creates a new options instance.
    • Method Detail

      • isRemove

        public boolean isRemove()
        Returns the remove
        Returns:
        the remove
      • remove

        @Deprecated
        public FindAndModifyOptions remove​(boolean remove)
        Deprecated.
        This will be removed in 2.0. use Datastore.findAndDelete(Query) to remove items.
        Indicates whether to remove the elements matching the query or not
        Parameters:
        remove - true if the matching elements should be deleted
        Returns:
        this
      • isUpsert

        public boolean isUpsert()
        Returns the upsert
        Returns:
        the upsert
      • isReturnNew

        public boolean isReturnNew()
        Returns the returnNew
        Returns:
        the returnNew
      • returnNew

        public FindAndModifyOptions returnNew​(boolean returnNew)
        Sets the returnNew
        Parameters:
        returnNew - the returnNew
        Returns:
        this
      • getBypassDocumentValidation

        public java.lang.Boolean getBypassDocumentValidation()
        Returns the bypassDocumentValidation
        Returns:
        the bypassDocumentValidation
      • bypassDocumentValidation

        public FindAndModifyOptions bypassDocumentValidation​(java.lang.Boolean bypassDocumentValidation)
        Sets the bypassDocumentValidation
        Parameters:
        bypassDocumentValidation - the bypassDocumentValidation
        Returns:
        this
      • getMaxTime

        public long getMaxTime​(java.util.concurrent.TimeUnit timeUnit)
        Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.
        Parameters:
        timeUnit - the time unit to return the result in
        Returns:
        the maximum execution time in the given time unit
        MongoDB documentation
        reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
      • getWriteConcern

        public com.mongodb.WriteConcern getWriteConcern()
        Returns the writeConcern
        Returns:
        the writeConcern
        Since server release
        3.2
      • writeConcern

        public FindAndModifyOptions writeConcern​(com.mongodb.WriteConcern writeConcern)
        Sets the writeConcern
        Parameters:
        writeConcern - the writeConcern
        Returns:
        this
        Since server release
        3.2
      • getCollation

        public com.mongodb.client.model.Collation getCollation()
        Returns the collation options
        Returns:
        the collation options
        Since server release
        3.4
      • collation

        public FindAndModifyOptions collation​(com.mongodb.client.model.Collation collation)
        Sets the collation
        Parameters:
        collation - the collation
        Returns:
        this
        Since server release
        3.4