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

      • getOptions

        public com.mongodb.client.model.DBCollectionFindAndModifyOptions getOptions()
        Returns:
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • projection

        public FindAndModifyOptions projection​(com.mongodb.DBObject projection)
        Parameters:
        projection -
        Returns:
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • sort

        public FindAndModifyOptions sort​(com.mongodb.DBObject sort)
        Sets the sort
        Parameters:
        sort - the sort
        Returns:
        this
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • isRemove

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

        public FindAndModifyOptions remove​(boolean remove)
        Indicates whether to remove the elements matching the query or not
        Parameters:
        remove - true if the matching elements should be deleted
        Returns:
        this
      • update

        public FindAndModifyOptions update​(com.mongodb.DBObject update)
        Sets the update
        Parameters:
        update - the update
        Returns:
        this
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • 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