Package dev.morphia

Class UpdateOptions

  • All Implemented Interfaces:
    dev.morphia.internal.CollectionConfigurable<UpdateOptions>, dev.morphia.internal.CollectionConfiguration, dev.morphia.internal.WriteConfigurable<UpdateOptions>

    public class UpdateOptions
    extends com.mongodb.client.model.UpdateOptions
    implements dev.morphia.internal.WriteConfigurable<UpdateOptions>, dev.morphia.internal.CollectionConfigurable<UpdateOptions>
    The options to apply when updating documents in the MongoCollection
    Since:
    1.3
    • Constructor Detail

      • UpdateOptions

        public UpdateOptions()
    • Method Detail

      • arrayFilter

        public UpdateOptions arrayFilter​(Filter filter)
        Adds a new array filter
        Parameters:
        filter - the new filter
        Returns:
        this
        Since:
        2.1
      • collection

        public UpdateOptions collection​(String collection)
        Description copied from interface: dev.morphia.internal.CollectionConfigurable
        Sets the alternate collection to use for the operation.
        Specified by:
        collection in interface dev.morphia.internal.CollectionConfigurable<UpdateOptions>
        Parameters:
        collection - the name of the collection to use
        Returns:
        this
      • collection

        public String collection()
        Description copied from interface: dev.morphia.internal.CollectionConfigurable
        Returns the alternate collection to use for the operation. Might return null.
        Specified by:
        collection in interface dev.morphia.internal.CollectionConfigurable<UpdateOptions>
        Returns:
        the collection name or null
      • comment

        public UpdateOptions comment​(String comment)
        Overrides:
        comment in class com.mongodb.client.model.UpdateOptions
        Parameters:
        comment - the comment
        Returns:
        this
        Since:
        2.3
        See Also:
        InsertOneOptions.comment(String)
      • comment

        public UpdateOptions comment​(org.bson.BsonValue comment)
        Overrides:
        comment in class com.mongodb.client.model.UpdateOptions
        Parameters:
        comment - the comment
        Returns:
        this
        Since:
        2.3
        See Also:
        InsertOneOptions.comment(BsonValue)
      • let

        public UpdateOptions let​(org.bson.conversions.Bson variables)
        Overrides:
        let in class com.mongodb.client.model.UpdateOptions
        Returns:
        this
        Since:
        2.3
        See Also:
        UpdateOptions.let(Bson)
      • hint

        public UpdateOptions hint​(org.bson.Document hint)
        Parameters:
        hint - the hint to apply
        Returns:
        this
        Since:
        2.2
        See Also:
        hint(Bson), UpdateOptions.hint(Bson)
      • multi

        public UpdateOptions multi​(boolean multi)
        If true, sets this update to affect all matched documents.
        Parameters:
        multi - true for multiple updates
        Returns:
        this
      • sort

        public UpdateOptions sort​(org.bson.conversions.Bson sort)
        Overrides:
        sort in class com.mongodb.client.model.UpdateOptions
      • upsert

        public UpdateOptions upsert​(boolean upsert)
        Overrides:
        upsert in class com.mongodb.client.model.UpdateOptions
      • bypassDocumentValidation

        public UpdateOptions bypassDocumentValidation​(@Nullable
                                                      Boolean bypassDocumentValidation)
        Overrides:
        bypassDocumentValidation in class com.mongodb.client.model.UpdateOptions
      • collation

        public UpdateOptions collation​(@Nullable
                                       com.mongodb.client.model.Collation collation)
        Overrides:
        collation in class com.mongodb.client.model.UpdateOptions
      • arrayFilters

        public UpdateOptions arrayFilters​(@Nullable
                                          List<? extends org.bson.conversions.Bson> arrayFilters)
        Overrides:
        arrayFilters in class com.mongodb.client.model.UpdateOptions
      • isMulti

        @Deprecated(forRemoval=true,
                    since="2.3")
        public boolean isMulti()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        true if the update should affect all entities
      • multi

        @MorphiaInternal
        public boolean multi()
        Returns:
        true if the update should affect all entities
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • hint

        public UpdateOptions hint​(@Nullable
                                  org.bson.conversions.Bson hint)
        Overrides:
        hint in class com.mongodb.client.model.UpdateOptions
        Returns:
        this
        Since:
        2.2
      • hintString

        public UpdateOptions hintString​(@Nullable
                                        String hint)
        Overrides:
        hintString in class com.mongodb.client.model.UpdateOptions
        Returns:
        this
        Since:
        2.2
      • writeConcern

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

        public com.mongodb.WriteConcern writeConcern()
        The write concern to use for the insertion. By default the write concern configured for the MongoCollection instance will be used.
        Specified by:
        writeConcern in interface dev.morphia.internal.WriteConfigurable<UpdateOptions>
        Returns:
        the write concern, or null if the default will be used.