本文整理了Java中org.springframework.data.mongodb.core.MongoTemplate.executeQuery()
方法的一些代码示例,展示了MongoTemplate.executeQuery()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoTemplate.executeQuery()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.MongoTemplate
类名称:MongoTemplate
方法名:executeQuery
[英]Execute a MongoDB query and iterate over the query results on a per-document basis with a DocumentCallbackHandler using the provided CursorPreparer.
[中]
代码示例来源:origin: spring-projects/spring-data-mongodb
@Override
public void executeQuery(Query query, String collectionName, DocumentCallbackHandler dch) {
executeQuery(query, collectionName, dch, new QueryCursorPreparer(query, null));
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
@Override
public void executeQuery(Query query, String collectionName, DocumentCallbackHandler dch) {
executeQuery(query, collectionName, dch, new QueryCursorPreparer(query, null));
}
代码示例来源:origin: pl.edu.icm.crpd/crpd-persistence
public void processFiles(final ContentFileHandler handler) {
mongo.executeQuery(new Query(), GRID_FS_THESIS_CONTENT_BUCKET+".files", new DocumentCallbackHandler() {
public void processDocument(DBObject dbObject) {
handler.process(GridFsFileToContentFileConverter.convert(dbObject));
}
});
handler.finish();
}
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
@Override
public List<String> findAllIds() {
Query query = new Query();
query.fields().include(FLOW_ID_KEY);
final List<String> results = new ArrayList<String>();
DocumentCallbackHandler dch = new DocumentCallbackHandler() {
@Override
public void processDocument(final DBObject dbObject) throws MongoException, DataAccessException {
Object object = dbObject.get(FLOW_ID_KEY);
results.add(object.toString());
}
};
mongoTemplate.executeQuery(query, collectionName, dch);
return results;
}
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
private List<FlowInfo> queryForFlowInfo(final Query query) {
query.fields().include(FLOW_ID_KEY).include(FLOW_NAME_KEY).include(FLOW_DESCRIPTION_KEY)
.include(MODIFICATION_TIME_KEY);
final List<FlowInfo> results = new ArrayList<FlowInfo>();
DocumentCallbackHandler dch = new DocumentCallbackHandler() {
@Override
public void processDocument(final DBObject dbObject) throws MongoException, DataAccessException {
String flowId = (String) dbObject.get(FLOW_ID_KEY);
String flowName = (String) dbObject.get(FLOW_NAME_KEY);
String flowDescription = (String) dbObject.get(FLOW_DESCRIPTION_KEY);
Date modificationDate = (Date) dbObject.get(MODIFICATION_TIME_KEY);
FlowInfo flowInfo = new FlowInfo(flowId, flowName, flowDescription, modificationDate);
results.add(flowInfo);
}
};
mongoTemplate.executeQuery(query, collectionName, dch);
return results;
}
内容来源于网络,如有侵权,请联系作者删除!