1

Mongo aggregation framework has some changes in version 3.6 Earlier aggregation queries with monger are not working even when we pass :cursor {} as an option. Is there any workaround or do we have to wait for the next monger release?. The error we get is specified below

MongoCommandException Command failed with error 9: 'The 'cursor' option is required, except for aggregate with the explain argument' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "The 'cursor' option is required, except for aggregate with the explain argument", "code" : 9, "codeName" : "FailedToParse" } com.mongodb.connection.ProtocolHelper.getCommandFailureException (ProtocolHelper.java:115)

Rishin S Babu
  • 1,553
  • 3
  • 13
  • 16

2 Answers2

1

by OSt advice, I could run monger aggregation sample with codes below.

(mc/aggregate db coll
    [{"$project" {:subtotal {"$multiply" ["$quantity", "$price"]}
                  :_id "$state"}}]
    :cursor {:batch-size 0})

thanks!

0

According to mongo db spec, cursor became a required field in some cases. So you should provide it through monger API. It is not a problem in monger, it is a breakable change in mongo db API.

OSt
  • 1
  • 1