mongdb 使用聚合函数异常
异常信息:
Command execution failed: Error [The 'cursor' option is required, except for aggregate with the explain argument], Command = { "aggregate" : "mg_day_statistics" , "pipeline" : [ { "$match" : { "_id" : { "$exists" : true}}} , { "$group" : { "_id" : null , "totalAmount" : { "$sum" : "$amount"}}}]}; nested exception is com.mongodb.MongoCommandException: Command failed with error 9: 'The 'cursor' option is required, except for aggregate with the explain argument' on server 120.24.38.204:28018. The full response is { "ok" : 0.0, "errmsg" : "The 'cursor' option is required, except for aggregate with the explain argument", "code" : 9, "codeName" : "FailedToParse" }
异常原因:这是 springboot 1.5.8.RELEASE 的 bug 修改成 1.5.10.RELEASE 就可以了
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> <relativePath/>
posted on 2019-11-19 17:23 zhangyukun 阅读(641) 评论(0) 编辑 收藏 举报