【发布时间】:2017-10-06 18:53:10
【问题描述】:
我想在 spring data mongodb 中执行以下原生查询:
db.runCommand({aggregate:"mycollection", pipeline :[{$match : {$and :
[{"orderDate" : {$gte : ISODate("2016-07-25T10:33:04.196Z")}},
{"orderDate" : {$lte :ISODate("2018-07-25T10:33:04.196Z")
}}
]}},
{ "$project" : { "orderType" : 1 ,"count" : 1 ,
"month" : { "$month" : [ "$orderDate"]}}},
{ "$group" : { "_id" : { "month" : "$month" , "orderType" : "$orderType"} ,
"count" : { "$sum" : 1} }}],
cursor:{batchSize:1000}})
我尝试使用 mongoTemplate.executeCommand 它执行一个 json 字符串,请帮助...
问候
克里斯
【问题讨论】:
标签: java spring mongodb spring-data-mongodb