org.mongodb.morphia.query
Interface UpdateOperations<T>

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

public interface UpdateOperations<T>

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
 UpdateOperations<T> add(String fieldExpr, Object value)
          adds the value to an array field
 UpdateOperations<T> add(String fieldExpr, Object value, boolean addDups)
           
 UpdateOperations<T> addAll(String fieldExpr, List<?> values, boolean addDups)
          adds the values to an array field
 UpdateOperations<T> dec(String fieldExpr)
          decrements the numeric field by 1
 UpdateOperations<T> disableValidation()
          Turns off validation (for all calls made after)
 UpdateOperations<T> enableValidation()
          Turns on validation (for all calls made after); by default validation is on
 UpdateOperations<T> inc(String fieldExpr)
          increments the numeric field by 1
 UpdateOperations<T> inc(String fieldExpr, Number value)
          increments the numeric field by value (negatives are allowed)
 UpdateOperations<T> isolated()
          Enables isolation (so this update happens in one shot, without yielding)
 UpdateOperations<T> max(String fieldExpr, Number value)
          sets the numeric field to value if it is greater than the current value.
 UpdateOperations<T> min(String fieldExpr, Number value)
          sets the numeric field to value if it is less than the current value.
 UpdateOperations<T> removeAll(String fieldExpr, List<?> values)
          removes the values from the array field
 UpdateOperations<T> removeAll(String fieldExpr, Object value)
          removes the value from the array field
 UpdateOperations<T> removeFirst(String fieldExpr)
          removes the first value from the array
 UpdateOperations<T> removeLast(String fieldExpr)
          removes the last value from the array
 UpdateOperations<T> set(String fieldExpr, Object value)
          sets the field value
 UpdateOperations<T> setOnInsert(String fieldExpr, Object value)
          sets the field on insert.
 UpdateOperations<T> unset(String fieldExpr)
          removes the field
 

Method Detail

set

UpdateOperations<T> set(String fieldExpr,
                        Object value)
sets the field value


setOnInsert

UpdateOperations<T> setOnInsert(String fieldExpr,
                                Object value)
sets the field on insert.


unset

UpdateOperations<T> unset(String fieldExpr)
removes the field


add

UpdateOperations<T> add(String fieldExpr,
                        Object value)
adds the value to an array field


add

UpdateOperations<T> add(String fieldExpr,
                        Object value,
                        boolean addDups)

addAll

UpdateOperations<T> addAll(String fieldExpr,
                           List<?> values,
                           boolean addDups)
adds the values to an array field


removeFirst

UpdateOperations<T> removeFirst(String fieldExpr)
removes the first value from the array


removeLast

UpdateOperations<T> removeLast(String fieldExpr)
removes the last value from the array


removeAll

UpdateOperations<T> removeAll(String fieldExpr,
                              Object value)
removes the value from the array field


removeAll

UpdateOperations<T> removeAll(String fieldExpr,
                              List<?> values)
removes the values from the array field


dec

UpdateOperations<T> dec(String fieldExpr)
decrements the numeric field by 1


inc

UpdateOperations<T> inc(String fieldExpr)
increments the numeric field by 1


inc

UpdateOperations<T> inc(String fieldExpr,
                        Number value)
increments the numeric field by value (negatives are allowed)


max

UpdateOperations<T> max(String fieldExpr,
                        Number value)
sets the numeric field to value if it is greater than the current value.


min

UpdateOperations<T> min(String fieldExpr,
                        Number value)
sets the numeric field to value if it is less than the current value.


enableValidation

UpdateOperations<T> enableValidation()
Turns on validation (for all calls made after); by default validation is on


disableValidation

UpdateOperations<T> disableValidation()
Turns off validation (for all calls made after)


isolated

UpdateOperations<T> isolated()
Enables isolation (so this update happens in one shot, without yielding)