Package dev.morphia.query
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 theQuery.update(UpdateOperator, UpdateOperator...)
instead of this class directlyA nicer interface to the update operations in mongodb. 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 Deprecated Methods Modifier and Type Method Description UpdateOperations<T>
addToSet(String field, 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 arrayUpdateOperations<T>
addToSet(String field, 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 arrayUpdateOperations<T>
addToSet(String field, 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 arrayUpdateOperations<T>
dec(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Decrements the numeric field by 1UpdateOperations<T>
dec(String field, 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 onUpdateOperations<T>
inc(String field)
Deprecated, for removal: This API element is subject to removal in a future version.Increments the numeric field by 1UpdateOperations<T>
inc(String field, 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(String field, 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(String field, 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(String field, 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(String field, 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 positionUpdateOperations<T>
push(String field, 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(String field, 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 positionUpdateOperations<T>
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 fieldUpdateOperations<T>
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 fieldUpdateOperations<T>
removeFirst(String field)
Deprecated, for removal: This API element is subject to removal in a future version.removes the first value from the arrayUpdateOperations<T>
removeLast(String field)
Deprecated, for removal: This API element is subject to removal in a future version.removes the last value from the arrayUpdateOperations<T>
set(String field, Object value)
Deprecated, for removal: This API element is subject to removal in a future version.sets the field valueUpdateOperations<T>
setOnInsert(String field, Object value)
Deprecated, for removal: This API element is subject to removal in a future version.sets the field on insert.UpdateOperations<T>
unset(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(String field, 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 updatevalue
- the value to add- Returns:
- this
- MongoDB documentation
- $addToSet
-
addToSet
UpdateOperations<T> addToSet(String field, 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 updatevalues
- the values to add- Returns:
- this
- MongoDB documentation
- $addToSet
-
addToSet
UpdateOperations<T> addToSet(String field, 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 updatevalues
- the values to add- Returns:
- this
- MongoDB documentation
- $addToSet
-
dec
UpdateOperations<T> dec(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
- $inc
-
dec
UpdateOperations<T> dec(String field, 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 updatevalue
- 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
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(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
- $inc
-
inc
UpdateOperations<T> inc(String field, 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 updatevalue
- the value to increment by- Returns:
- this
- MongoDB documentation
- $inc
-
max
UpdateOperations<T> max(String field, 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 updatevalue
- the value to use- Returns:
- this
- MongoDB documentation
- $max
-
min
UpdateOperations<T> min(String field, 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 updatevalue
- the value to use- Returns:
- this
- MongoDB documentation
- $min
-
push
UpdateOperations<T> push(String field, 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 updatedvalue
- the value to add- Returns:
- this
- MongoDB documentation
- $push
-
push
UpdateOperations<T> push(String field, 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 updatedvalue
- the value to addoptions
- the options to apply to the push- Returns:
- this
- MongoDB documentation
- $push
-
push
UpdateOperations<T> push(String field, 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 updatedvalues
- the values to add- Returns:
- this
- MongoDB documentation
- $push
-
push
UpdateOperations<T> push(String field, 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 updatedvalues
- the values to addoptions
- the options to apply to the push- Returns:
- this
- MongoDB documentation
- $push
-
removeAll
UpdateOperations<T> 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 updatevalue
- the value to use- Returns:
- this
- MongoDB documentation
- $pull
-
removeAll
UpdateOperations<T> 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 updatevalues
- the values to use- Returns:
- this
- MongoDB documentation
- $pullAll
-
removeFirst
UpdateOperations<T> removeFirst(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
- $pop
-
removeLast
UpdateOperations<T> removeLast(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
- $pop
-
set
UpdateOperations<T> set(String field, 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 updatevalue
- the value to use- Returns:
- this
- MongoDB documentation
- $set
-
setOnInsert
UpdateOperations<T> setOnInsert(String field, 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 updatevalue
- the value to use- Returns:
- this
- MongoDB documentation
- $setOnInsert
-
unset
UpdateOperations<T> unset(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
- $unset
-
-