Class UpdateOptions


  • public class UpdateOptions
    extends Object
    Options for configuring updates.
    Author:
    Nick Scavelli
    • Field Detail

      • DEFAULT_UPSERT

        public static final boolean DEFAULT_UPSERT
        The default value of upsert = false
        See Also:
        Constant Field Values
      • DEFAULT_MULTI

        public static final boolean DEFAULT_MULTI
        The default value of multi = false
        See Also:
        Constant Field Values
      • DEFAULT_RETURN_NEW_DOCUMENT

        public static final boolean DEFAULT_RETURN_NEW_DOCUMENT
        The default value of returning new document = false
        See Also:
        Constant Field Values
    • Constructor Detail

      • UpdateOptions

        public UpdateOptions()
        Default constructor
      • UpdateOptions

        public UpdateOptions​(boolean upsert)
        Constructor specify upsert
        Parameters:
        upsert - the value of upsert
      • UpdateOptions

        public UpdateOptions​(boolean upsert,
                             boolean multi)
        Constructor specify upsert and multi
        Parameters:
        upsert - the value of upsert
        multi - the value of multi
      • UpdateOptions

        public UpdateOptions​(UpdateOptions other)
        Copy constructor
        Parameters:
        other - the one to copy
      • UpdateOptions

        public UpdateOptions​(JsonObject json)
        Constructor from JSON
        Parameters:
        json - the json
    • Method Detail

      • getWriteOption

        public WriteOption getWriteOption()
        Get the write option.
        Returns:
        the write option
      • setWriteOption

        public UpdateOptions setWriteOption​(WriteOption writeOption)
        Set the write option
        Parameters:
        writeOption - the write option
        Returns:
        reference to this, for fluency
      • isUpsert

        public boolean isUpsert()
        Get whether upsert is enabled
        Returns:
        upsert is enabled?
      • setUpsert

        public UpdateOptions setUpsert​(boolean upsert)
        Set whether upsert is enabled
        Parameters:
        upsert - true if enabled
        Returns:
        reference to this, for fluency
      • isReturningNewDocument

        public boolean isReturningNewDocument()
        Get whether returning new document property is enabled. Valid only on findOneAnd* methods.
        Returns:
        new document property is enabled?
      • setReturningNewDocument

        public UpdateOptions setReturningNewDocument​(boolean returnNewDocument)
        Set whether new document property is enabled. Valid only on findOneAnd* methods.
        Parameters:
        returnNewDocument - true if enabled
        Returns:
        reference to this, for fluency
      • isMulti

        public boolean isMulti()
        Get whether multi is enabled. Multi means more than one document can be updated.
        Returns:
        multi is enabled?
      • setMulti

        public UpdateOptions setMulti​(boolean multi)
        Set whether multi is enabled
        Parameters:
        multi - true if enabled
        Returns:
        reference to this, for fluency
      • getArrayFilters

        public JsonArray getArrayFilters()
        Get the arrayFilters option.
        Returns:
        the arrayFilters option
      • setArrayFilters

        public UpdateOptions setArrayFilters​(JsonArray arrayFilters)
        Set the arrayFilters option
        Parameters:
        arrayFilters - the arrayFilters option
        Returns:
        reference to this, for fluency
      • getHint

        public JsonObject getHint()
        Get the hint.
        Returns:
        the hint
      • setHint

        public UpdateOptions setHint​(JsonObject hint)
        Set the hint.
        Parameters:
        hint - the hint
        Returns:
        reference to this, for fluency
      • getHintString

        public String getHintString()
        Get the hint string.
        Returns:
        the hint string
      • setHintString

        public UpdateOptions setHintString​(String hintString)
        Set the hint string.
        Parameters:
        hintString - the hint string
        Returns:
        reference to this, for fluency
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object