Interface UpdateOperations<T>

  • Type Parameters:
    T - The Java type used in the updates
    All Known Implementing Classes:
    UpdateOpsImpl

    @Deprecated(since="2.0",
                forRemoval=true)
    public interface UpdateOperations<T>
    Deprecated, for removal: This API element is subject to removal in a future version.
    updates should be performed using the Query.update() instead of this class directly

    A nicer interface to the update operations in monogodb. All these operations happen at the server and can cause the server and client version of the Entity to be different

    • Method Summary

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

      • addToSet

        UpdateOperations<T> addToSet​(java.lang.String field,
                                     java.lang.Object value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> addToSet​(java.lang.String field,
                                     java.util.List<?> values)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> addToSet​(java.lang.String field,
                                     java.lang.Iterable<?> values)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> dec​(java.lang.String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Decrements the numeric field by 1
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/inc/ $inc
      • dec

        UpdateOperations<T> dec​(java.lang.String field,
                                java.lang.Number value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> disableValidation()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Turns off validation (for all calls made after)
        Returns:
        this
      • enableValidation

        UpdateOperations<T> enableValidation()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Turns on validation (for all calls made after); by default validation is on
        Returns:
        this
      • inc

        UpdateOperations<T> inc​(java.lang.String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Increments the numeric field by 1
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/inc/ $inc
      • inc

        UpdateOperations<T> inc​(java.lang.String field,
                                java.lang.Number value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> max​(java.lang.String field,
                                java.lang.Number value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> min​(java.lang.String field,
                                java.lang.Number value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> push​(java.lang.String field,
                                 java.lang.Object value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> push​(java.lang.String field,
                                 java.lang.Object value,
                                 PushOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> push​(java.lang.String field,
                                 java.util.List<?> values)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> push​(java.lang.String field,
                                 java.util.List<?> values,
                                 PushOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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

        UpdateOperations<T> removeAll​(java.lang.String field,
                                      java.lang.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
        reference/operator/update/pull/ $pull
      • removeAll

        UpdateOperations<T> removeAll​(java.lang.String field,
                                      java.util.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
        reference/operator/update/pullAll/ $pullAll
      • removeFirst

        UpdateOperations<T> removeFirst​(java.lang.String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        removes the first value from the array
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pop/ $pop
      • removeLast

        UpdateOperations<T> removeLast​(java.lang.String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        removes the last value from the array
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/pop/ $pop
      • set

        UpdateOperations<T> set​(java.lang.String field,
                                java.lang.Object value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        sets the field value
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/set/ $set
      • setOnInsert

        UpdateOperations<T> setOnInsert​(java.lang.String field,
                                        java.lang.Object value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        sets the field on insert.
        Parameters:
        field - the field to update
        value - the value to use
        Returns:
        this
        MongoDB documentation
        reference/operator/update/setOnInsert/ $setOnInsert
      • unset

        UpdateOperations<T> unset​(java.lang.String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        removes the field
        Parameters:
        field - the field to update
        Returns:
        this
        MongoDB documentation
        reference/operator/update/unset/ $unset