Interface Updates<Updater extends Updates>

  • Type Parameters:
    Updater -

    public interface Updates<Updater extends Updates>
    Defines the update operations available
    • Method Detail

      • addToSet

        Updater addToSet​(String field,
                         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
        $addToSet
      • addToSet

        Updater addToSet​(String field,
                         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
        $addToSet
      • addToSet

        Updater addToSet​(String field,
                         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
        $addToSet
      • dec

        Updater dec​(String field)
        Decrements the numeric field by 1
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        $inc
      • dec

        Updater dec​(String field,
                    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:
        IllegalArgumentException - of the value is not an instance of Double, Float,Long, or Integer
        MongoDB documentation
        $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​(String field)
        Increments the numeric field by 1
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        $inc
      • inc

        Updater inc​(String field,
                    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
        $inc
      • max

        Updater max​(String field,
                    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
        $max
      • min

        Updater min​(String field,
                    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
        $min
      • push

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

        Updater push​(String field,
                     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
        $push
      • push

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

        Updater push​(String field,
                     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
        $push
      • removeAll

        @Deprecated(since="2.0",
                    forRemoval=true)
        default Updater removeAll​(String field,
                                  Object value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        removes the value from the array field
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        $pull
      • pull

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

        @Deprecated(since="2.0",
                    forRemoval=true)
        default Updater removeAll​(String field,
                                  List<?> values)
        Deprecated, for removal: This API element is subject to removal in a future version.
        removes the values from the array field
        Parameters:
        field - the field to update
        values - the values to use
        Returns:
        this
        MongoDB documentation
        $pullAll
      • pullAll

        Updater pullAll​(String field,
                        List<?> values)
        removes the values from the array field
        Parameters:
        field - the field to update
        values - the values to use
        Returns:
        this
        MongoDB documentation
        $pullAll
      • removeFirst

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

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

        Updater set​(String field,
                    Object value)
        sets the field value
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        $set
      • set

        Updater set​(Object entity)
        sets the entity value to completely replace the stored document
        Parameters:
        entity - the entity to store
        Returns:
        this
        MongoDB documentation
        $set
      • setOnInsert

        Updater setOnInsert​(String field,
                            Object value)
        sets the field on insert.
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        $setOnInsert
      • unset

        Updater unset​(String field)
        removes the field
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        $unset