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

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.5.6
    • Fix Version/s: 3.4.6, 3.5.10
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL
    • Backport Requested:
      v3.4
    • Sprint:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: