Package dev.morphia

Class DeleteOptions

  • All Implemented Interfaces:
    dev.morphia.internal.SessionConfigurable<DeleteOptions>

    public final class DeleteOptions
    extends com.mongodb.client.model.DeleteOptions
    implements dev.morphia.internal.SessionConfigurable<DeleteOptions>
    The options to apply when removing documents from the MongoCollection
    Since:
    1.3
    MongoDB documentation
    tutorial/remove-documents/ Remove Documents
    • Constructor Detail

      • DeleteOptions

        public DeleteOptions()
        Creates a new options instance
      • DeleteOptions

        public DeleteOptions​(DeleteOptions that)
        Parameters:
        that - the options to copy
        Since:
        2.0
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Method Detail

      • apply

        public <T> com.mongodb.client.MongoCollection<T> apply​(com.mongodb.client.MongoCollection<T> collection)
        Applies the options to the collection
        Type Parameters:
        T - the collection type
        Parameters:
        collection - the collection to update
        Returns:
        either the passed collection or the updated collection
        Since:
        2.0
      • clientSession

        public DeleteOptions 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<DeleteOptions>
        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<DeleteOptions>
        Returns:
        the client session
      • collation

        public DeleteOptions collation​(com.mongodb.client.model.Collation collation)
        Overrides:
        collation in class com.mongodb.client.model.DeleteOptions
      • getWriteConcern

        @Deprecated(since="2.0",
                    forRemoval=true)
        public com.mongodb.WriteConcern getWriteConcern()
        Deprecated, for removal: This API element is subject to removal in a future version.
        use writeConcern() instead
        The write concern to use for the delete.
        Returns:
        the write concern, or null if the default will be used.
      • isMulti

        public boolean isMulti()
        Returns:
        is this delete for multiple documents
      • multi

        public DeleteOptions multi​(boolean multi)
        Parameters:
        multi - true if this delete should affect multiple documents
        Returns:
        this
      • writeConcern

        public com.mongodb.WriteConcern writeConcern()
        The write concern to use for the delete.
        Returns:
        the write concern, or null if the default will be used.
      • writeConcern

        public DeleteOptions writeConcern​(com.mongodb.WriteConcern writeConcern)
        Sets the write concern
        Parameters:
        writeConcern - the write concern
        Returns:
        this