【发布时间】:2017-03-27 09:23:44
【问题描述】:
我正在尝试从 spring 框架的 mongoTemplete 的 executeCommand 执行诸如“db.post.find().pretty()”之类的查询。但是我做不到?有没有办法直接从mongotempelate执行上面的查询?任何帮助表示赞赏。
这是我的代码:
public CommandResult getMongoReportResult(){
CommandResult result=mongoTemplate.executeCommand("{$and:[{\"by\":\"tutorials point\"},{\"title\": \"MongoDB Overview\"}]}");
return result;
}
【问题讨论】:
标签: java spring mongodb mongotemplate