Operational Defect Database

BugZero found this defect 68 days ago.

MongoDB | 2606416

Incorrect null equality check for objects inside arrays

Last update date:

3/12/2024

Affected products:

MongoDB Server

Affected releases:

6.0.14

Fixed releases:

No fixed releases provided.

Description:

Info

Null equality seems to evaluate always to true when comparing a field of a document inside an array. Concretely, Given this dataset of 3 elements [ { "xs": [ { "name": "a" } ] }, { "xs": [ { "name": null } ] }, { "xs": [ {} ] } ] When performing the query db.collection.find({ "xs.0.name": { $eq: null } }) we would expect to get the 2nd and 3rd result, but the actual result is that all documents are returned. The following returns the expected results: db.collection.find({ "$or": [ { "xs.0.name": { $exists: false } }, { "xs.0.name": { $type: "null" } } ] })

Top User Comments


Steps to Reproduce

The description can be used as steps to reproduce.

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Needs Verification

Learn More

Search:

...