Interface Updates<Updater extends Updates>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Updater addToSet​(java.lang.String field, java.lang.Iterable<?> values)
      adds the values to an array field if they doesn't already exist in the array
      Updater addToSet​(java.lang.String field, java.lang.Object value)
      adds the value to an array field if it doesn't already exist in the array
      Updater addToSet​(java.lang.String field, java.util.List<?> values)
      adds the values to an array field if they doesn't already exist in the array
      Updater dec​(java.lang.String field)
      Decrements the numeric field by 1
      Updater dec​(java.lang.String field, java.lang.Number value)
      Decrements the numeric field by value (must be a positive Double, Float, Long, or Integer).
      Updater disableValidation()
      Turns off validation (for all calls made after)
      Updater enableValidation()
      Turns on validation (for all calls made after); by default validation is on
      Updater inc​(java.lang.String field)
      Increments the numeric field by 1
      Updater inc​(java.lang.String field, java.lang.Number value)
      increments the numeric field by value (negatives are allowed)
      Updater max​(java.lang.String field, java.lang.Number value)
      Sets the numeric field to value if it is greater than the current value.
      Updater min​(java.lang.String field, java.lang.Number value)
      sets the numeric field to value if it is less than the current value.
      Updater push​(java.lang.String field, java.lang.Object value)
      Adds new values to an array field.
      Updater push​(java.lang.String field, java.lang.Object value, PushOptions options)
      Adds new values to an array field at the given position
      Updater push​(java.lang.String field, java.util.List<?> values)
      Adds new values to an array field.
      Updater push​(java.lang.String field, java.util.List<?> values, PushOptions options)
      Adds new values to an array field at the given position
      Updater removeAll​(java.lang.String field, java.lang.Object value)
      removes the value from the array field
      Updater removeAll​(java.lang.String field, java.util.List<?> values)
      removes the values from the array field
      Updater removeFirst​(java.lang.String field)
      removes the first value from the array
      Updater removeLast​(java.lang.String field)
      removes the last value from the array
      Updater set​(java.lang.String field, java.lang.Object value)
      sets the field value
      Updater setOnInsert​(java.lang.String field, java.lang.Object value)
      sets the field on insert.
      Updater unset​(java.lang.String field)
      removes the field
    • Method Detail

      • addToSet

        Updater addToSet​(java.lang.String field,
                         java.lang.Object value)
        adds the value to an array field if it doesn't already exist in the array
        Parameters:
        field - the field to update
        value - the value to add
        Returns:
        this
        MongoDB documentation
        reference/operator/update/addToSet/ $addToSet
      • addToSet

        Updater addToSet​(java.lang.String field,
                         java.util.List<?> values)
        adds the values to an array field if they doesn't already exist in the array
        Parameters:
        field - the field to update
        values - the values to add
        Returns:
        this
        MongoDB documentation
        reference/operator/update/addToSet/ $addToSet
      • addToSet

        Updater addToSet​(java.lang.String field,
                         java.lang.Iterable<?> values)
        adds the values to an array field if they doesn't already exist in the array
        Parameters:
        field - the field to update
        values - the values to add
        Returns:
        this
        MongoDB documentation
        reference/operator/update/addToSet/ $addToSet
      • dec

        Updater dec​(java.lang.String field,
                    java.lang.Number value)
        Decrements the numeric field by value (must be a positive Double, Float, Long, or Integer).
        Parameters:
        field - the field to update
        value - the value to decrement by
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - of the value is not an instance of Double, Float,Long, or Integer
        MongoDB documentation
        reference/operator/update/inc/ $inc
      • disableValidation

        Updater disableValidation()
        Turns off validation (for all calls made after)
        Returns:
        this
      • enableValidation

        Updater enableValidation()
        Turns on validation (for all calls made after); by default validation is on
        Returns:
        this
      • inc

        Updater inc​(java.lang.String field,
                    java.lang.Number value)
        increments the numeric field by value (negatives are allowed)
        Parameters:
        field - the field to update
        value - the value to increment by
        Returns:
        this
        MongoDB documentation
        reference/operator/update/inc/ $inc
      • max

        Updater max​(java.lang.String field,
                    java.lang.Number value)
        Sets the numeric field to value if it is greater than the current value.
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/max/ $max
      • min

        Updater min​(java.lang.String field,
                    java.lang.Number value)
        sets the numeric field to value if it is less than the current value.
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/min/ $min
      • push

        Updater push​(java.lang.String field,
                     java.lang.Object value)
        Adds new values to an array field.
        Parameters:
        field - the field to updated
        value - the value to add
        Returns:
        this
        MongoDB documentation
        reference/operator/update/push/ $push
      • push

        Updater push​(java.lang.String field,
                     java.lang.Object value,
                     PushOptions options)
        Adds new values to an array field at the given position
        Parameters:
        field - the field to updated
        value - the value to add
        options - the options to apply to the push
        Returns:
        this
        MongoDB documentation
        reference/operator/update/push/ $push
      • push

        Updater push​(java.lang.String field,
                     java.util.List<?> values)
        Adds new values to an array field.
        Parameters:
        field - the field to updated
        values - the values to add
        Returns:
        this
        MongoDB documentation
        reference/operator/update/push/ $push
      • push

        Updater push​(java.lang.String field,
                     java.util.List<?> values,
                     PushOptions options)
        Adds new values to an array field at the given position
        Parameters:
        field - the field to updated
        values - the values to add
        options - the options to apply to the push
        Returns:
        this
        MongoDB documentation
        reference/operator/update/push/ $push
      • removeAll

        Updater removeAll​(java.lang.String field,
                          java.lang.Object value)
        removes the value from the array field
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pull/ $pull
      • removeAll

        Updater removeAll​(java.lang.String field,
                          java.util.List<?> values)
        removes the values from the array field
        Parameters:
        field - the field to update
        values - the values to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pullAll/ $pullAll
      • removeFirst

        Updater removeFirst​(java.lang.String field)
        removes the first value from the array
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pop/ $pop
      • removeLast

        Updater removeLast​(java.lang.String field)
        removes the last value from the array
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pop/ $pop
      • set

        Updater set​(java.lang.String field,
                    java.lang.Object value)
        sets the field value
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/set/ $set