org.springframework.data.mongodb.core.MongoTemplate.updateMulti()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(537)

本文整理了Java中org.springframework.data.mongodb.core.MongoTemplate.updateMulti()方法的一些代码示例,展示了MongoTemplate.updateMulti()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoTemplate.updateMulti()方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.MongoTemplate
类名称:MongoTemplate
方法名:updateMulti

MongoTemplate.updateMulti介绍

暂无

代码示例

代码示例来源:origin: kaaproject/kaa

protected void updateMulti(Query query, Update update) {
 mongoTemplate.updateMulti(query, update, getDocumentClass());
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void updateById(RoncooUser roncooUser) {
  Criteria criteria = Criteria.where("id").in(roncooUser.getId());
  Query query = new Query(criteria);
  Update update = new Update();
  update.set("name", roncooUser.getName());
  update.set("createTime", roncooUser.getCreateTime());
  mongoTemplate.updateMulti(query, update, RoncooUser.class);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void deleteExecutionStatistics(TestItem item) {
  mongoTemplate.updateMulti(getLaunchQuery(item.getLaunchRef()), fromItemStatusAware(item, true), Launch.class);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public void updateNotificationsToSentViaEmail(Collection<String> notificationIds) {
  List<ObjectId> objectIdList = new ArrayList<ObjectId>();
  for (String notificationId : notificationIds) {
    objectIdList.add(new ObjectId(notificationId));
  }
  Criteria criteria = Criteria.where(QUERY_PARAM_ID).in(objectIdList);
  Query query = new Query(criteria);
  Update update = new Update();
  update.set(QUERY_PARAM_NOTIFICATION_SENT_VIA_EMAIL, true);
  mongoTemplate.updateMulti(query, update, mongoCollectionName);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void removeUserFromProjects(String userId) {
  Query query = Query.query(Criteria.where(USER_LOGIN).is(userId));
  mongoTemplate.updateMulti(query, new Update().pull("users", new BasicDBObject("login", userId)), Project.class);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void resetExecutionStatistics(TestItem item) {
  mongoTemplate.updateMulti(getLaunchQuery(item.getLaunchRef()), fromItemStatusAware(item.getStatus(), -1, -1), Launch.class);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void updateUserRef(String oldOwner, String newOwner) {
  mongoTemplate.updateMulti(query(where(USER_ID_REFERENCE).is(oldOwner)), Update.update(USER_ID_REFERENCE, null), Launch.class);
}

代码示例来源:origin: pl.edu.icm.polindex/polindex-tools

@Override
public int removeTag(RecordQuery recordQuery, Tag tag) {
  Update update = new Update().pull(F_TAGS, tag.getTag());
  logger.debug("executing mongo update: {} on records selected by: {}", update.getUpdateObject(), recordQuery.getQuery());
  WriteResult res = mongoTemplate.updateMulti(recordQuery.getQuery(), update, collectionName);
  logger.debug("removed tag " + tag + " from " + res.getN() + " records");
  return res.getN();
}

代码示例来源:origin: pl.edu.icm.polindex/polindex-tools

@Override
public int addTag(RecordQuery recordQuery, Tag tag) {
  Update update = new Update().push(F_TAGS, tag.getTag());
  logger.debug("executing mongo update: {} on records selected by: {}", update.getUpdateObject(), recordQuery.getQuery());
  WriteResult res = mongoTemplate.updateMulti(recordQuery.getQuery(), update, collectionName);
  logger.debug("added tag " + tag + " to " + res.getN() + " records");
  return res.getN();
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void updateIssueStatistics(TestItem item, Project.Configuration settings) {
  mongoTemplate.updateMulti(getLaunchQuery(item.getLaunchRef()),
      fromIssueTypeAware(settings.getByLocator(item.getIssue().getIssueType()), 1),
      Launch.class
  );
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void resetIssueStatistics(TestItem item, Project.Configuration settings) {
  mongoTemplate.updateMulti(getLaunchQuery(item.getLaunchRef()),
      fromIssueTypeAware(settings.getByLocator(item.getIssue().getIssueType()), -1),
      Launch.class
  );
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
  public void deleteUnsharedFilters(String username, String project, String filterId) {
    Query query = Query.query(where("userRef").ne(username))
        .addCriteria(where("projectRef").is(project))
        .addCriteria(where("launchTabs.filters").is(filterId));

    Update update = new Update().pull("launchTabs.filters", filterId);
    mongoTemplate.updateMulti(query, update, UserPreference.class);

  }
}

相关文章