-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:OS:
node.js / npm versions:
Additional info:
Problem Statement/Rationale
Server v8 has subtly changed how it matches BSON undefined values with BSON null. The example given in the compatibility doc, though, doesn’t work on mongosh because mongosh silently maps all JS undefined values to BSON null rather than BSON undefined.
While the rationale for that mapping is documented, it’s quite surprising and could conceivably corrupt customer data.
Steps to Reproduce
Follow the example in the 8.0 compat document: create a people collection with the three documents shown, then run the find() command given.
Expected Results
One of the following:
- The example would work as expected: I’d see two documents. There’d be a warning about the use of BSON undefined.
- mongosh would warn about the use of deprecated BSON undefined but still do the insert.
- mongosh would throw on use of BSON undefined.
Actual Results
I see 3 documents because the one that I expect to have BSON undefined has BSON null instead.
Additional Notes
Any additional information that may be useful to include.
- related to
-
NODE-6442 Changing BSONUndefined to null happens silently
- Closed
-
NODE-6440 Add a way to construct BSONUndefined
- Backlog
-
SERVER-81378 Change classic behavior: equality to null should not match undefined
- Closed