Operational Defect Database

BugZero found this defect 2443 days ago.

MongoDB | 394558

[SERVER-29676] arrayToObject should not error out on explicit value of null for value

Last update date:

10/30/2023

Affected products:

MongoDB Server

Affected releases:

3.5.6

Fixed releases:

3.4.6

3.5.10

Description:

Info

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

Top User Comments

xgen-internal-githook commented on Tue, 27 Jun 2017 13:39:54 +0000: Author: {u'username': u'sindbach', u'name': u'Wan Bachtiar', u'email': u'sindbach@gmail.com'} Message: SERVER-29676 arrayToObject should not error out on explicit value of null or undefined for value Closes #1158 Signed-off-by: Tess Avitabile <tess.avitabile@mongodb.com> (cherry picked from commit 21f0ae2d10531d0897c55c7be16f783abb6a8e1d) Branch: v3.4 https://github.com/mongodb/mongo/commit/7bb1b5f71c2b7b48802ef5b41860713e2add25e0 xgen-internal-githook commented on Thu, 22 Jun 2017 15:18:55 +0000: Author: {u'username': u'sindbach', u'name': u'Wan Bachtiar', u'email': u'sindbach@gmail.com'} Message: SERVER-29676 arrayToObject should not error out on explicit value of null or undefined for value Closes #1158 Signed-off-by: Tess Avitabile <tess.avitabile@mongodb.com> Branch: master https://github.com/mongodb/mongo/commit/21f0ae2d10531d0897c55c7be16f783abb6a8e1d asya commented on Thu, 15 Jun 2017 20:56:40 +0000: I believe the test on this line: https://github.com/mongodb/mongo/blob/9822df6e71b0c5793676f9358e5d212c103c19a7/src/mongo/db/pipeline/expression.cpp#L612 should be !value.missing() and not !value.nullish()

Additional Resources / Links

Share:

BugZero Risk Score

Coming soon

Status

Closed

Have you been affected by this bug?

cost-cta-background

Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.

Discussion

Login to read and write comments.

Have you ever...

had your data corrupted from a

VMware

bug?

Search:

...