-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
At present, MongoDB allows a $group with duplicate accumulator names to execute. Ex:
db.runCommand({ aggregate: "coll", pipeline: [{$group: {_id: null, a: {$min: "$x"}, a: {$min: "$y"}}}] })
When run in mongo shell, this example will only produce one accumulator named "a" because mongo shell will eliminate the duplicate accumulators before the command is sent over the wire to mongod.
Unfortunately, if this command is run using a MongoDB driver that doesn't eliminate accumulators with duplicate names client-side, then the result will contain documents with duplicate field names.
The goal of this task is to determine what a better approach would be for handling $group with duplicate accumulator names, and then to implement this better approach.