Package org.mongojack
Class DBUpdate
- java.lang.Object
-
- org.mongojack.DBUpdate
-
@Deprecated public class DBUpdate extends Object
Deprecated.Use com.mongodb.client.model.UpdatesA database update. This can be used to build queries using the MongoDB modifier operations. It also will do serialisation of values, however it won't honour any custom serialisers specified on the fields that those values are being set.The Builder is a Bson, which makes it compatible with the methods in the JacksonMongoCollection that accept Bson-update objects, and makes those methods interoperable with Mongo's internal Updates class. But be warned that Builder.initialize has to be called before Builder.toBsonDocument, or exceptions will result. JacksonMongoCollection takes care of calling initialize for you.
- Since:
- 1.1
- Author:
- James Roper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DBUpdate.Builder
Deprecated.The builder
-
Constructor Summary
Constructors Constructor Description DBUpdate()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DBUpdate.Builder
addToSet(String field, Object value)
Deprecated.Add the given value to the array value if it doesn't already exist in the specified field atomicallystatic DBUpdate.Builder
addToSet(String field, Object... values)
Deprecated.Add the given values to the array value if they don't already exist in the specified field atomicallystatic DBUpdate.Builder
addToSet(String field, List<?> values)
Deprecated.Add the given values to the array value if they don't already exist in the specified field atomicallystatic DBUpdate.Builder
bit(String field, String operation, int value)
Deprecated.Perform a bit operation on the given fieldstatic DBUpdate.Builder
bit(String field, String operation1, int value1, String operation2, int value2)
Deprecated.Perform two bit operations on the given fieldstatic DBUpdate.Builder
bitwiseAnd(String field, int value)
Deprecated.Perform a bitwise and on the given fieldstatic DBUpdate.Builder
bitwiseOr(String field, int value)
Deprecated.Perform a bitwise or on the given fieldstatic DBUpdate.Builder
inc(String field)
Deprecated.Increment the given field atomically by onestatic DBUpdate.Builder
inc(String field, int by)
Deprecated.Increment the given field atomically by the given valuestatic DBUpdate.Builder
popFirst(String field)
Deprecated.Remove the first value from the array specified by field atomicallystatic DBUpdate.Builder
popLast(String field)
Deprecated.Remove the last value from the array specified by field atomicallystatic DBUpdate.Builder
pull(String field, Object value)
Deprecated.Remove all occurances of value from the array at fieldstatic DBUpdate.Builder
pullAll(String field, Object... values)
Deprecated.Remove all occurances of the values from the array at fieldstatic DBUpdate.Builder
pullAll(String field, List<?> values)
Deprecated.Remove all occurances of the values from the array at fieldstatic DBUpdate.Builder
push(String field, Object value)
Deprecated.Add the given value to the array value at the specified field atomicallystatic DBUpdate.Builder
pushAll(String field, Object... values)
Deprecated.Add all of the given values to the array value at the specified field atomicallystatic DBUpdate.Builder
pushAll(String field, List<?> values)
Deprecated.Add all of the given values to the array value at the specified field atomicallystatic DBUpdate.Builder
rename(String oldFieldName, String newFieldName)
Deprecated.Rename the given field to the new field namestatic DBUpdate.Builder
set(String field, Object value)
Deprecated.Set the given field (can be multiple levels deep) to the given value atomicallystatic DBUpdate.Builder
unset(String field)
Deprecated.Unset the given field atomically
-
-
-
Method Detail
-
inc
public static DBUpdate.Builder inc(String field)
Deprecated.Increment the given field atomically by one- Parameters:
field
- The field to increment- Returns:
- this object
-
inc
public static DBUpdate.Builder inc(String field, int by)
Deprecated.Increment the given field atomically by the given value- Parameters:
field
- The field to incrementby
- The value to increment by- Returns:
- this object
-
set
public static DBUpdate.Builder set(String field, Object value)
Deprecated.Set the given field (can be multiple levels deep) to the given value atomically- Parameters:
field
- The field to setvalue
- The value to set it to- Returns:
- this object
-
unset
public static DBUpdate.Builder unset(String field)
Deprecated.Unset the given field atomically- Parameters:
field
- The field to unset- Returns:
- this object
-
push
public static DBUpdate.Builder push(String field, Object value)
Deprecated.Add the given value to the array value at the specified field atomically- Parameters:
field
- The field to add the value tovalue
- The value to add- Returns:
- this object
-
pushAll
public static DBUpdate.Builder pushAll(String field, Object... values)
Deprecated.Add all of the given values to the array value at the specified field atomically- Parameters:
field
- The field to add the values tovalues
- The values to add- Returns:
- this object
-
pushAll
public static DBUpdate.Builder pushAll(String field, List<?> values)
Deprecated.Add all of the given values to the array value at the specified field atomically- Parameters:
field
- The field to add the values tovalues
- The values to add- Returns:
- this object
-
addToSet
public static DBUpdate.Builder addToSet(String field, Object value)
Deprecated.Add the given value to the array value if it doesn't already exist in the specified field atomically- Parameters:
field
- The field to add the value tovalue
- The value to add- Returns:
- this object
-
addToSet
public static DBUpdate.Builder addToSet(String field, Object... values)
Deprecated.Add the given values to the array value if they don't already exist in the specified field atomically- Parameters:
field
- The field to add the values tovalues
- The values to add- Returns:
- this object
-
addToSet
public static DBUpdate.Builder addToSet(String field, List<?> values)
Deprecated.Add the given values to the array value if they don't already exist in the specified field atomically- Parameters:
field
- The field to add the values tovalues
- The values to add- Returns:
- this object
-
popFirst
public static DBUpdate.Builder popFirst(String field)
Deprecated.Remove the first value from the array specified by field atomically- Parameters:
field
- The field to remove the value from- Returns:
- this object
-
popLast
public static DBUpdate.Builder popLast(String field)
Deprecated.Remove the last value from the array specified by field atomically- Parameters:
field
- The field to remove the value from- Returns:
- this object
-
pull
public static DBUpdate.Builder pull(String field, Object value)
Deprecated.Remove all occurances of value from the array at field- Parameters:
field
- The field to remove the value fromvalue
- The value to remove. This may be another query.- Returns:
- this object
-
pullAll
public static DBUpdate.Builder pullAll(String field, Object... values)
Deprecated.Remove all occurances of the values from the array at field- Parameters:
field
- The field to remove the values fromvalues
- The values to remove- Returns:
- this object
-
pullAll
public static DBUpdate.Builder pullAll(String field, List<?> values)
Deprecated.Remove all occurances of the values from the array at field- Parameters:
field
- The field to remove the values fromvalues
- The values to remove- Returns:
- this object
-
rename
public static DBUpdate.Builder rename(String oldFieldName, String newFieldName)
Deprecated.Rename the given field to the new field name- Parameters:
oldFieldName
- The old field namenewFieldName
- The new field name- Returns:
- this object
-
bit
public static DBUpdate.Builder bit(String field, String operation, int value)
Deprecated.Perform a bit operation on the given field- Parameters:
field
- The field to perform the operation onoperation
- The operation to performvalue
- The value- Returns:
- this object
-
bit
public static DBUpdate.Builder bit(String field, String operation1, int value1, String operation2, int value2)
Deprecated.Perform two bit operations on the given field- Parameters:
field
- The field to perform the operations onoperation1
- The first operation to performvalue1
- The first valueoperation2
- The second operation to performvalue2
- The second value- Returns:
- this object
-
bitwiseAnd
public static DBUpdate.Builder bitwiseAnd(String field, int value)
Deprecated.Perform a bitwise and on the given field- Parameters:
field
- The field to perform the and onvalue
- The value- Returns:
- this object
-
bitwiseOr
public static DBUpdate.Builder bitwiseOr(String field, int value)
Deprecated.Perform a bitwise or on the given field- Parameters:
field
- The field to perform the or onvalue
- The value- Returns:
- this object
-
-