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

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

    • Minor Change
    • ALL
    • v3.4
    • Query 2017-07-10

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

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

              Created:
              Updated:
              Resolved: