-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation pipeline, Embedded Shell
-
None
Problem Statement/Rationale
The translation of an aggregation using the mongo shell appears incorrect. It provides the following example syntax for an aggregation:
mongo 'mongodb://localhost:27017' --eval "db = db.getSiblingDB('db'); db.collection.aggregate({ 'x': new NumberLong(0), 'y': new ObjectId() });"
Aggregation should be using a pipeline represented as an array though. Also, this needs the $match stage (assuming this is meant to be a filter).
Actually executing this yields the following error:
uncaught exception: Error: command failed: { "ok" : 0, "errmsg" : "A pipeline stage specification object must contain exactly one field.", "code" : 40323, "codeName" : "Location40323" } : aggregate failed :
Additional Notes
While this ticket only covers the shell, the other examples look like they might have the same issue, since none of them specify $match or use arrays for the pipeline. I haven't personally tested them yet though.
More broadly speaking, it seems like we might want to consider running integration tests using the generated output to ensure they're correct.