TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

first attempt to fix aggregation issue #182 (don't merge) #191

Closed gianpaj closed 5 years ago

gianpaj commented 6 years ago

This fixes the db.coll.aggregate([...]) with an array. But not with the helpers that this library has

Gianfrancos-MacBook-Pro(mongod-4.0.0) test> db.coll.aggregate([{ $project: { location: { $indexOfBytes: ["$string", "world"] } } }])
{ "_id": ObjectId("5b54a352214a68545d311e40"), "location": 6 }
Fetched 1 record(s) in 0ms

e.g. this will still no work: db.coll.aggregate({})

2018-07-22T19:49:06.255+0300 E QUERY    [js] uncaught exception: aggregation failed: {
  "ok": 0,
  "errmsg": "The 'cursor' option is required, except for aggregate with the explain argument",
  "code": 9,
  "codeName": "FailedToParse"
}

PS: I'm also not sure if the explain is doing anything now