failedToParse: The 'cursor' option is required, except for aggregate with the explain argument
See original GitHub issue$ mongo
MongoDB shell version v3.6.0
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.0
Mongo-Hacker 0.0.14
> db.coll.insert({string: 'hello world1 world2'} )
> db.coll.aggregate([{ $project: { location: { $indexOfBytes: ["$string", "world"] } } }])
printStackTrace@src/mongo/shell/utils.js:74:15
DBCollection.prototype.aggregate@/Users/gianfranco/.mongorc.js:98:13
@(shell):1:1
2017-12-17T18:49:20.838+0200 E QUERY [thread1] uncaught exception: aggregate failed: {
"ok": 0,
"errmsg": "The 'cursor' option is required, except for aggregate with the explain argument",
"code": 9,
"codeName": "FailedToParse"
}
Issue also with aggregate() function without the array.
> db.coll.aggregate().project({ location: { $indexOfBytes: ["$string", "world"] } })
printStackTrace@src/mongo/shell/utils.js:74:15
Aggregation.prototype.execute@/Users/gianfranco/.mongorc.js:152:9
Aggregation.prototype.shellPrint@/Users/gianfranco/.mongorc.js:170:9
shellPrintHelper@src/mongo/shell/utils.js:539:1
@(shell2):1:1
2017-12-17T18:56:54.026+0200 E QUERY [thread1] uncaught exception: aggregation failed: {
"ok": 0,
"errmsg": "The 'cursor' option is required, except for aggregate with the explain argument",
"code": 9,
"codeName": "FailedToParse"
}
$ mongo --norc
> db.coll.aggregate([{ $project: { location: { $indexOfBytes: ["$string", "world"] } } }])
{ "_id" : ObjectId("5a36a07f36f314ee708bdf8b"), "location" : 6 }
same issue with mongo shell 3.4.3 btw
Looks like the issue is also(?) related to the server version
- Server 3.4.3 with mongo shell 3.4.3 + mongo hacker ✅
- Server 3.4.3 with mongo shell 3.6.0 + mongo hacker ✅
- Server 3.6.0 with mongo shell 3.6.0 or 3.4.3 + mongo hacker ❌
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Spring data mongodb - The 'cursor' option is required
MongoDB changed in 3.6 how the aggregation command works. Aggregations require now a cursor. We adapted Spring Data MongoDB 2.1 but not ...
Read more >The 'cursor' option is required, except for aggregate ... - GitHub
Hi After running a mongo and mirrogate dockers (from readme files) and trying to save a dashboard I got an error :com.mongodb.
Read more >Aggregation examples don't work due to missing cursor option
"errmsg" : "The 'cursor' option is required, except for aggregate with the explain argument",. "code" : 9,. "codeName" : "FailedToParse".
Read more >Lab 4.2 Aggregation Performance - M201 - MongoDB
... "errmsg": "The 'cursor' option is required, except for aggregate with the explain argument", "code": 9, "codeName": "FailedToParse" }.
Read more >Node.js – Mongodb error : The 'cursor' option is required ...
How can I fix them? The error message: { MongoError: The 'cursor' option is required, except for aggregation explain at Function.MongoError.create (/data/deploy ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

any fix for this issue? experiencing the same problem with latest stable 3.6.x mongodb and latest mongo-hacker
I’ve created a pull request 😃