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

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

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

MongoTemplate.stream介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public <T> CloseableIterator<T> stream(final Query query, final Class<T> entityType) {
  return stream(query, entityType, operations.determineCollectionName(entityType));
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public <T> CloseableIterator<T> stream(final Query query, final Class<T> entityType) {
  return stream(query, entityType, operations.determineCollectionName(entityType));
}

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

@Override
public Stream<Launch> streamModifiedInRange(String project, Date from, Date to) {
  Query query = Query.query(Criteria.where(Modifiable.LAST_MODIFIED).gte(from).lte((to)))
      .addCriteria(Criteria.where(PROJECT_ID_REFERENCE).is(project));
  query.fields().include(ID_REFERENCE);
  return Streams.stream(mongoTemplate.stream(query, Launch.class));
}

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

@Override
public void updateItemsIssues(Map<String, TestItemIssue> forUpdate) {
  Query query = query(where(ID).in(forUpdate.keySet()));
  Update update = new Update();
  mongoTemplate.stream(query, TestItem.class).forEachRemaining(dbo -> {
    String currentId = dbo.getId();
    TestItemIssue newValue = forUpdate.get(currentId);
    update.set(ISSUE_TYPE, newValue.getIssueType());
    update.set(ISSUE_DESCRIPTION, newValue.getIssueDescription());
    update.set(ISSUE_TICKET, newValue.getExternalSystemIssues());
    update.set(ISSUE_ANALYZED, newValue.isAutoAnalyzed());
    mongoTemplate.updateFirst(Query.query(Criteria.where(ID).is(currentId)), update,
        mongoTemplate.getCollectionName(TestItem.class)
    );
  });
}

相关文章