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

arrayToObject should not error out on explicit value of null for value

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.5.6
    • 3.4.6, 3.5.10
    • Aggregation Framework
    • None
    • Minor Change
    • ALL
    • v3.4
    • Query 2017-07-10

    Description

      If my object is o:{ "foo": null } and {$objectToArray:"$o"} converts it to {k:"foo",v:null} then $arrayToObject must be able to convert it back to the object, but instead it gives the error:

      Error: command failed: {
      	"ok" : 0,
      	"errmsg" : "$arrayToObject requires an object with keys 'k' and 'v'. Missing either or both keys from: {k: \"comment\", v: null}",
      	"code" : 40393,
      	"codeName" : "Location40393"
      }
      

      Explicit null is a different type than missing, so we're probably checking for "nullish" when we should be checking for "missing".

      Attachments

        Activity

          People

            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: