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

Inconsistent handling of arrays as $group keys

    • Minor Change
    • ALL
    • Query 2019-09-23, Query 2019-10-07

      > db.foo.find()
      { "_id" : 2 }
      { "_id" : 1, "x" : null }
      { "_id" : 3, "y" : null }
      { "_id" : 4, "x" : null, "y" : null }
      > db.foo.aggregate([{$group: {_id: ["$x", "$y"]}}])
      { "_id" : [ "$x", "$y" ] }
      > db.foo.aggregate([{$group: {_id: {z: ["$x", "$y"]}}}])
      { "_id" : { "z" : [ null, null ] } }
      

      I would contend that the middle one should result in

      {_id: [null, null]}
      

      Looks like this is the offending line.

            Assignee:
            ted.tuckman@mongodb.com Ted Tuckman
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: