public class UpdateOpsImpl<T> extends Object implements UpdateOperations<T>
| Constructor and Description |
|---|
UpdateOpsImpl(Class<T> type,
Mapper mapper) |
| Modifier and Type | Method and Description |
|---|---|
UpdateOperations<T> |
add(String fieldExpr,
Object value)
adds the value to an array field
|
UpdateOperations<T> |
add(String fieldExpr,
Object value,
boolean addDups) |
protected void |
add(UpdateOperator op,
String f,
Object value,
boolean convert) |
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
|
DBObject |
getOps() |
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)
|
boolean |
isIsolated() |
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.
|
protected UpdateOperations<T> |
remove(String fieldExpr,
boolean firstNotLast) |
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.
|
void |
setOps(DBObject ops) |
protected List<Object> |
toDBObjList(MappedField mf,
List<?> values) |
UpdateOperations<T> |
unset(String fieldExpr)
removes the field
|
public UpdateOperations<T> enableValidation()
UpdateOperationsenableValidation in interface UpdateOperations<T>public UpdateOperations<T> disableValidation()
UpdateOperationsdisableValidation in interface UpdateOperations<T>public UpdateOperations<T> isolated()
UpdateOperationsisolated in interface UpdateOperations<T>public boolean isIsolated()
public void setOps(DBObject ops)
public DBObject getOps()
public UpdateOperations<T> add(String fieldExpr, Object value)
UpdateOperationsadd in interface UpdateOperations<T>public UpdateOperations<T> add(String fieldExpr, Object value, boolean addDups)
add in interface UpdateOperations<T>public UpdateOperations<T> addAll(String fieldExpr, List<?> values, boolean addDups)
UpdateOperationsaddAll in interface UpdateOperations<T>public UpdateOperations<T> dec(String fieldExpr)
UpdateOperationsdec in interface UpdateOperations<T>public UpdateOperations<T> inc(String fieldExpr)
UpdateOperationsinc in interface UpdateOperations<T>public UpdateOperations<T> inc(String fieldExpr, Number value)
UpdateOperationsinc in interface UpdateOperations<T>public UpdateOperations<T> max(String fieldExpr, Number value)
UpdateOperationsmax in interface UpdateOperations<T>public UpdateOperations<T> min(String fieldExpr, Number value)
UpdateOperationsmin in interface UpdateOperations<T>protected UpdateOperations<T> remove(String fieldExpr, boolean firstNotLast)
public UpdateOperations<T> removeAll(String fieldExpr, Object value)
UpdateOperationsremoveAll in interface UpdateOperations<T>public UpdateOperations<T> removeAll(String fieldExpr, List<?> values)
UpdateOperationsremoveAll in interface UpdateOperations<T>public UpdateOperations<T> removeFirst(String fieldExpr)
UpdateOperationsremoveFirst in interface UpdateOperations<T>public UpdateOperations<T> removeLast(String fieldExpr)
UpdateOperationsremoveLast in interface UpdateOperations<T>public UpdateOperations<T> set(String fieldExpr, Object value)
UpdateOperationsset in interface UpdateOperations<T>public UpdateOperations<T> setOnInsert(String fieldExpr, Object value)
UpdateOperationssetOnInsert in interface UpdateOperations<T>public UpdateOperations<T> unset(String fieldExpr)
UpdateOperationsunset in interface UpdateOperations<T>protected List<Object> toDBObjList(MappedField mf, List<?> values)
protected void add(UpdateOperator op, String f, Object value, boolean convert)