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

Inconsistent handling of arrays as $group keys

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL
    • Sprint:
      Query 2019-09-23, Query 2019-10-07

      Description

      > 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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: