Package dev.morphia.query
Class UpdateBase<T,Updater extends Updates>
- java.lang.Object
-
- dev.morphia.query.UpdateBase<T,Updater>
-
- Type Parameters:
T
-Updater
-
- All Implemented Interfaces:
Updates<Updater>
public abstract class UpdateBase<T,Updater extends Updates> extends Object implements Updates<Updater>
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Updater
addToSet(String field, Iterable<?> values)
adds the values to an array field if they doesn't already exist in the arrayUpdater
addToSet(String field, Object value)
adds the value to an array field if it doesn't already exist in the arrayUpdater
addToSet(String field, List<?> values)
adds the values to an array field if they doesn't already exist in the arrayUpdater
dec(String field)
Decrements the numeric field by 1Updater
dec(String field, Number value)
Decrements the numeric field by value (must be a positive Double, Float, Long, or Integer).Updater
disableValidation()
Turns off validation (for all calls made after)Updater
enableValidation()
Turns on validation (for all calls made after); by default validation is onprotected DatastoreImpl
getDatastore()
protected Class<T>
getType()
Updater
inc(String field)
Increments the numeric field by 1Updater
inc(String field, Number value)
increments the numeric field by value (negatives are allowed)Updater
max(String field, Number value)
Sets the numeric field to value if it is greater than the current value.Updater
min(String field, Number value)
sets the numeric field to value if it is less than the current value.Updater
pull(String field, Object value)
removes the value from the array fieldUpdater
pullAll(String field, List<?> values)
removes the values from the array fieldUpdater
push(String field, Object value)
Adds new values to an array field.Updater
push(String field, Object value, PushOptions options)
Adds new values to an array field at the given positionUpdater
push(String field, List<?> values)
Adds new values to an array field.Updater
push(String field, List<?> values, PushOptions options)
Adds new values to an array field at the given positionprotected Updater
remove(String fieldExpr, boolean firstNotLast)
Updater
removeAll(String field, Object value)
removes the value from the array fieldUpdater
removeAll(String field, List<?> values)
removes the values from the array fieldUpdater
removeFirst(String field)
removes the first value from the arrayUpdater
removeLast(String field)
removes the last value from the arrayUpdater
set(Object entity)
sets the entity value to completely replace the stored documentUpdater
set(String field, Object value)
sets the field valueUpdater
setOnInsert(String field, Object value)
sets the field on insert.org.bson.Document
toDocument()
String
toString()
Updater
unset(String field)
removes the field
-
-
-
Method Detail
-
getDatastore
protected DatastoreImpl getDatastore()
-
addToSet
public Updater addToSet(String field, Object value)
Description copied from interface:Updates
adds the value to an array field if it doesn't already exist in the array
-
addToSet
public Updater addToSet(String field, List<?> values)
Description copied from interface:Updates
adds the values to an array field if they doesn't already exist in the array
-
addToSet
public Updater addToSet(String field, Iterable<?> values)
Description copied from interface:Updates
adds the values to an array field if they doesn't already exist in the array
-
dec
public Updater dec(String field)
Description copied from interface:Updates
Decrements the numeric field by 1
-
dec
public Updater dec(String field, Number value)
Description copied from interface:Updates
Decrements the numeric field by value (must be a positive Double, Float, Long, or Integer).
-
disableValidation
public Updater disableValidation()
Description copied from interface:Updates
Turns off validation (for all calls made after)- Specified by:
disableValidation
in interfaceUpdates<T>
- Returns:
- this
-
enableValidation
public Updater enableValidation()
Description copied from interface:Updates
Turns on validation (for all calls made after); by default validation is on- Specified by:
enableValidation
in interfaceUpdates<T>
- Returns:
- this
-
inc
public Updater inc(String field)
Description copied from interface:Updates
Increments the numeric field by 1
-
inc
public Updater inc(String field, Number value)
Description copied from interface:Updates
increments the numeric field by value (negatives are allowed)
-
max
public Updater max(String field, Number value)
Description copied from interface:Updates
Sets the numeric field to value if it is greater than the current value.
-
min
public Updater min(String field, Number value)
Description copied from interface:Updates
sets the numeric field to value if it is less than the current value.
-
pull
public Updater pull(String field, Object value)
Description copied from interface:Updates
removes the value from the array field
-
pullAll
public Updater pullAll(String field, List<?> values)
Description copied from interface:Updates
removes the values from the array field
-
push
public Updater push(String field, Object value)
Description copied from interface:Updates
Adds new values to an array field.
-
push
public Updater push(String field, Object value, PushOptions options)
Description copied from interface:Updates
Adds new values to an array field at the given position
-
push
public Updater push(String field, List<?> values)
Description copied from interface:Updates
Adds new values to an array field.
-
push
public Updater push(String field, List<?> values, PushOptions options)
Description copied from interface:Updates
Adds new values to an array field at the given position
-
removeAll
public Updater removeAll(String field, Object value)
Description copied from interface:Updates
removes the value from the array field
-
removeAll
public Updater removeAll(String field, List<?> values)
Description copied from interface:Updates
removes the values from the array field
-
removeFirst
public Updater removeFirst(String field)
Description copied from interface:Updates
removes the first value from the array- Specified by:
removeFirst
in interfaceUpdates<T>
- Parameters:
field
- the field to update- Returns:
- this
-
removeLast
public Updater removeLast(String field)
Description copied from interface:Updates
removes the last value from the array- Specified by:
removeLast
in interfaceUpdates<T>
- Parameters:
field
- the field to update- Returns:
- this
-
set
public Updater set(String field, Object value)
Description copied from interface:Updates
sets the field value
-
set
public Updater set(Object entity)
Description copied from interface:Updates
sets the entity value to completely replace the stored document
-
setOnInsert
public Updater setOnInsert(String field, Object value)
Description copied from interface:Updates
sets the field on insert.- Specified by:
setOnInsert
in interfaceUpdates<T>
- Parameters:
field
- the field to updatevalue
- the value to use- Returns:
- this
-
unset
public Updater unset(String field)
Description copied from interface:Updates
removes the field
-
toDocument
public org.bson.Document toDocument()
- Returns:
- the operations listed
-
-