protected UpdateOperations<T> remove(String fieldExpr, boolean firstNotLast) { add(UpdateOperator.POP, fieldExpr, (firstNotLast) ? -1 : 1, false); return this; }
public UpdateOperations<T> unset(String fieldExpr) { add(UpdateOperator.UNSET, fieldExpr, 1, false); return this; }
public UpdateOperations<T> add(String fieldExpr, Object value) { return add(fieldExpr, value, false); }
public UpdateOperations<T> addAll(String fieldExpr, List<?> values, boolean addDups) { if (values == null || values.isEmpty()) throw new QueryException("Values cannot be null or empty."); // List<?> convertedValues = (List<?>)mapr.toMongoObject(values, true); if (addDups) add(UpdateOperator.PUSH_ALL, fieldExpr, values, true); else add(UpdateOperator.ADD_TO_SET_EACH, fieldExpr, values, true); return this; }
public UpdateOperations<T> set(String fieldExpr, Object value) { if (value == null) throw new QueryException("Value cannot be null."); // Object dbObj = mapr.toMongoObject(value, true); add(UpdateOperator.SET, fieldExpr, value, true); return this; }
public UpdateOperations<T> removeAll(String fieldExpr, Object value) { if (value == null) throw new QueryException("Value cannot be null."); // Object dbObj = mapr.toMongoObject(value); add(UpdateOperator.PULL, fieldExpr, value, true); return this; }
public UpdateOperations<T> removeAll(String fieldExpr, List<?> values) { if (values == null || values.isEmpty()) throw new QueryException("Value cannot be null or empty."); // List<Object> vals = toDBObjList(values); add(UpdateOperator.PULL_ALL, fieldExpr, values, true); return this; }
public UpdateOperations<T> add(String fieldExpr, Object value, boolean addDups) { if (value == null) throw new QueryException("Value cannot be null."); // Object dbObj = mapr.toMongoObject(value, true); add((addDups) ? UpdateOperator.PUSH : UpdateOperator.ADD_TO_SET, fieldExpr, value, true); return this; }
public UpdateOperations<T> inc(String fieldExpr, Number value) { if (value == null) throw new QueryException("Value cannot be null."); add(UpdateOperator.INC, fieldExpr, value, false); return this; }