Package dev.morphia

Class UpdateOptions

    • Constructor Detail

      • UpdateOptions

        public UpdateOptions()
    • Method Detail

      • apply

        public <T> com.mongodb.client.MongoCollection<T> apply​(com.mongodb.client.MongoCollection<T> collection)
        Updates the collection with the configured WriteConcern
        Type Parameters:
        T - the collection type
        Parameters:
        collection - the collection to update
        Returns:
        the potentially updated collection
      • clientSession

        public UpdateOptions 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<UpdateOptions>
        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<UpdateOptions>
        Returns:
        the client session
      • 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 insertion. By default the write concern configured for the MongoCollection instance will be used.
        Returns:
        the write concern, or null if the default will be used.
      • isMulti

        public boolean isMulti()
        Returns:
        true if the update should affect all entities
      • multi

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

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

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

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

        public UpdateOptions arrayFilters​(List<? extends org.bson.conversions.Bson> arrayFilters)
        Overrides:
        arrayFilters in class com.mongodb.client.model.UpdateOptions
      • 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.
        Returns:
        the write concern, or null if the default will be used.
      • writeConcern

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