Package dev.morphia

Class UpdateOptions

    • Constructor Summary

      Constructors 
      Constructor Description
      UpdateOptions()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UpdateOptions bypassDocumentValidation​(java.lang.Boolean bypassDocumentValidation)
      Sets the bypass document level validation flag.
      UpdateOptions collation​(com.mongodb.client.model.Collation collation)
      Sets the collation
      UpdateOptions copy()
      Create a copy of the options instance.
      java.lang.Boolean getBypassDocumentValidation()
      Gets the the bypass document level validation flag
      com.mongodb.client.model.Collation getCollation()
      Returns the collation options
      com.mongodb.client.model.DBCollectionUpdateOptions getOptions()  
      com.mongodb.WriteConcern getWriteConcern()
      The write concern to use for the insertion.
      boolean isMulti()
      Gets whether all documents matching the query filter will be removed.
      boolean isUpsert()
      Returns true if a new document should be inserted if there are no matches to the query filter.
      UpdateOptions multi​(boolean multi)
      Sets whether all documents matching the query filter will be removed.
      UpdateOptions upsert​(boolean isUpsert)
      Set to true if a new document should be inserted if there are no matches to the query filter.
      UpdateOptions writeConcern​(com.mongodb.WriteConcern writeConcern)
      Sets the write concern
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UpdateOptions

        public UpdateOptions()
    • Method Detail

      • copy

        public UpdateOptions copy()
        Create a copy of the options instance.
        Returns:
        the copy
      • isUpsert

        public boolean isUpsert()
        Returns true if a new document should be inserted if there are no matches to the query filter. The default is false.
        Returns:
        true if a new document should be inserted if there are no matches to the query filter
      • upsert

        public UpdateOptions upsert​(boolean isUpsert)
        Set to true if a new document should be inserted if there are no matches to the query filter.
        Parameters:
        isUpsert - true if a new document should be inserted if there are no matches to the query filter
        Returns:
        this
      • getBypassDocumentValidation

        public java.lang.Boolean getBypassDocumentValidation()
        Gets the the bypass document level validation flag
        Returns:
        the bypass document level validation flag
        Since server release
        3.2
      • bypassDocumentValidation

        public UpdateOptions bypassDocumentValidation​(java.lang.Boolean bypassDocumentValidation)
        Sets the bypass document level validation flag.
        Parameters:
        bypassDocumentValidation - If true, allows the write to opt-out of document level validation.
        Returns:
        this
        Since server release
        3.2
      • multi

        public UpdateOptions multi​(boolean multi)
        Sets whether all documents matching the query filter will be removed.
        Parameters:
        multi - true if all documents matching the query filter will be removed
        Returns:
        this
      • isMulti

        public boolean isMulti()
        Gets whether all documents matching the query filter will be removed. The default is true.
        Returns:
        whether all documents matching the query filter will be removed
      • getCollation

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

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

        public com.mongodb.WriteConcern getWriteConcern()
        The write concern to use for the insertion. By default the write concern configured for the DBCollection 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
      • getOptions

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