Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-94454

Determine better way to handle $group with duplicate accumulator names

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: