/** * Propagates {@code $each} to {@code $push} * * @param values * @return never {@literal null}. */ public Update each(Object... values) { this.modifiers.addModifier(new Each(values)); return Update.this.push(key, this.modifiers); }
/** * 更新对象 * @param user */ @Override public int updateUser(UserEntity user) { Query query=new Query(Criteria.where("id").is(user.getId())); Update update= new Update().set("userName", user.getUserName()).set("passWord", user.getPassWord()); //更新查询返回结果集的第一条 WriteResult result =mongoTemplate.updateFirst(query,update,UserEntity.class); //更新查询返回结果集的所有 // mongoTemplate.updateMulti(query,update,UserEntity.class); if(result!=null) return result.getN(); else return 0; }
/** * Set the level of comparison to perform. * * @param strength * @return new {@link Collation}. */ public Collation strength(int strength) { ComparisonLevel current = this.strength.orElseGet(() -> new ICUComparisonLevel(strength)); return strength(new ICUComparisonLevel(strength, current.getCaseFirst(), current.getCaseLevel())); }
/** * Set whether to include {@code caseLevel} comparison. <br /> * * @param caseLevel * @return new {@link Collation}. */ public Collation caseLevel(boolean caseLevel) { ComparisonLevel strengthValue = strength.orElseGet(ComparisonLevel::primary); return strength( new ICUComparisonLevel(strengthValue.getLevel(), strengthValue.getCaseFirst(), Optional.of(caseLevel))); }
/** * Set the flag that determines sort order of case differences during tertiary level comparisons. * * @param caseFirst must not be {@literal null}. * @return */ public Collation caseFirst(CaseFirst sort) { ComparisonLevel strengthValue = strength.orElseGet(ComparisonLevel::tertiary); return strength(new ICUComparisonLevel(strengthValue.getLevel(), Optional.of(sort), strengthValue.getCaseLevel())); }
/** * Get formatted representation of term. * * @return */ public String getFormatted() { String formatted = Type.PHRASE.equals(type) ? quotePhrase(raw) : raw; return negated ? negateRaw(formatted) : formatted; }
/** * Forces values to be added at the given {@literal position}. * * @param position the position offset. As of MongoDB 3.6 use a negative value to indicate starting from the end, * counting (but not including) the last element of the array. * @return never {@literal null}. * @since 1.7 */ public PushOperatorBuilder atPosition(int position) { this.modifiers.addModifier(new PositionModifier(position)); return this; }