/** * Perform two bit operations on the given field * * @param field The field to perform the operations on * @param operation1 The first operation to perform * @param value1 The first value * @param operation2 The second operation to perform * @param value2 The second value * @return this object */ public Builder bit(String field, String operation1, int value1, String operation2, int value2) { return addOperation("$bit", field, new BasicDBObject(operation1, value1).append(operation2, value2)); }
/** * Perform two bit operations on the given field * * @param field The field to perform the operations on * @param operation1 The first operation to perform * @param value1 The first value * @param operation2 The second operation to perform * @param value2 The second value * @return this object */ public static Builder bit(String field, String operation1, int value1, String operation2, int value2) { return new Builder().bit(field, operation1, value1, operation2, value2); }
/** * Perform two bit operations on the given field * * @param field The field to perform the operations on * @param operation1 The first operation to perform * @param value1 The first value * @param operation2 The second operation to perform * @param value2 The second value * @return this object */ public Builder bit(String field, String operation1, int value1, String operation2, int value2) { return addOperation("$bit", field, new BasicDBObject(operation1, value1).append(operation2, value2)); }
/** * Perform two bit operations on the given field * * @param field The field to perform the operations on * @param operation1 The first operation to perform * @param value1 The first value * @param operation2 The second operation to perform * @param value2 The second value * @return this object */ public static Builder bit(String field, String operation1, int value1, String operation2, int value2) { return new Builder().bit(field, operation1, value1, operation2, value2); }
/** * Remove all occurances of value from the array at field * * @param field The field to remove the value from * @param value The value to remove. This may be another query. * @return this object */ public Builder pull(String field, Object value) { return addOperation("$pull", field, value); }
/** * Add all of the given values to the array value at the specified field atomically * * @param field The field to add the values to * @param values The values to add * @return this object */ public static Builder pushAll(String field, Object... values) { return new Builder().pushAll(field, values); }
/** * Perform a bitwise or on the given field * * @param field The field to perform the or on * @param value The value * @return this object */ public Builder bitwiseOr(String field, int value) { return bit(field, "or", value); }
/** * Perform a bit operation on the given field * * @param field The field to perform the operation on * @param operation The operation to perform * @param value The value * @return this object */ public static Builder bit(String field, String operation, int value) { return new Builder().bit(field, operation, value); }
/** * Perform a bit operation on the given field * * @param field The field to perform the operation on * @param operation The operation to perform * @param value The value * @return this object */ public Builder bit(String field, String operation, int value) { return addOperation("$bit", field, new BasicDBObject(operation, value)); }
/** * Remove the first value from the array specified by field atomically * * @param field The field to remove the value from * @return this object */ public Builder popFirst(String field) { return addOperation("$pop", field, -1); }
/** * Add the given values to the array value if they don't already exist in the specified field atomically * * @param field The field to add the values to * @param values The values to add * @return this object */ public Builder addToSet(String field, Object... values) { return addOperation("$addToSet", field, new BasicDBObject("$each", values)); }
/** * Add all of the given values to the array value at the specified field atomically * * @param field The field to add the values to * @param values The values to add * @return this object */ public Builder pushAll(String field, List<?> values) { return addOperation("$pushAll", field, values); }
/** * Add all of the given values to the array value at the specified field atomically * * @param field The field to add the values to * @param values The values to add * @return this object */ public Builder pushAll(String field, Object... values) { return addOperation("$pushAll", field, values); }
/** * Rename the given field to the new field name * * @param oldFieldName The old field name * @param newFieldName The new field name * @return this object */ public Builder rename(String oldFieldName, String newFieldName) { return addOperation("$rename", oldFieldName, newFieldName); }
/** * Remove all occurances of value from the array at field * * @param field The field to remove the value from * @param value The value to remove. This may be another query. * @return this object */ public Builder pull(String field, Object value) { return addOperation("$pull", field, value); }
/** * Add the given values to the array value if they don't already exist in the specified field atomically * * @param field The field to add the values to * @param values The values to add * @return this object */ public Builder addToSet(String field, Object... values) { return addOperation("$addToSet", field, new BasicDBObject("$each", values)); }
/** * Add the given value to the array value if it doesn't already exist in the specified field atomically * * @param field The field to add the value to * @param value The value to add * @return this object */ public Builder addToSet(String field, Object value) { return addOperation("$addToSet", field, value); }