protected UpdateOperations<T> remove(String fieldExpr, boolean firstNotLast) { add(UpdateOperator.POP, fieldExpr, (firstNotLast) ? -1 : 1, false); return this; }
public static DBObject getUpdateOperations(UpdateOperations ops) { UpdateOpsImpl uo = (UpdateOpsImpl) ops; return uo.getOps(); }
public UpdateOperations<T> inc(String fieldExpr) { return inc(fieldExpr, 1); }
/** * @param query * @param ops * @param createIfMissing * @param multi * @param wc * @param <T> * @return */ @SuppressWarnings("rawtypes") private <T> UpdateResults<T> update(Query<T> query, UpdateOperations ops, boolean createIfMissing, boolean multi, WriteConcern wc) { DBObject u = ((UpdateOpsImpl) ops).getOps(); if (((UpdateOpsImpl) ops).isIsolated()) { Query<T> q = query.clone(); q.disableValidation().filter("$atomic", true); return update(q, u, createIfMissing, multi, wc); } return update(query, u, createIfMissing, multi, wc); }
public UpdateOperations<T> removeLast(String fieldExpr) { return remove(fieldExpr, false); }
/** * @param clazz * @param <T> * @return */ public <T> UpdateOperations<T> createUpdateOperations(Class<T> clazz) { return new UpdateOpsImpl<T>(clazz, getMapper()); }
/** * @param kind * @param ops * @param <T> * @return */ public <T> UpdateOperations<T> createUpdateOperations(Class<T> kind, DBObject ops) { UpdateOpsImpl<T> upOps = (UpdateOpsImpl<T>) createUpdateOperations(kind); upOps.setOps(ops); return upOps; }
val = toDBObjList(mf, (List<?>) value); else val = mapr.toMongoObject(mf, null, value);
public UpdateOperations<T> removeFirst(String fieldExpr) { return remove(fieldExpr, true); }
public UpdateOperations<T> unset(String fieldExpr) { add(UpdateOperator.UNSET, fieldExpr, 1, false); return this; }
query.getSortObject(), false, ((UpdateOpsImpl<T>) ops).getOps(), !oldVersion, createIfMissing); } catch (MongoException e) {
public UpdateOperations<T> dec(String fieldExpr) { return inc(fieldExpr, -1); }
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> 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; }
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; }