-
Type: Task
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
Use Case
As a... Node.js engineer
I want... to catch a mistaken change in the BSON deserialize API
So that... we do not introduce unintentional changes
User Experience
- What is the desired/expected outcome for the user once this ticket is implemented?
- BSON.deserialize on bytes that contain the deprecated undefined type return JS undefined
- If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?
- Not a bug
Dependencies
- None
Risks/Unknowns
- What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
- No risk, adding a test to reduce risk
- Is there an opportunity for better cross-driver alignment or testing in this area?
- Possibly, deprecated types are generally not useful but when a driver is deployed for the purpose of building a product over MongoDB rather than an application the ability to interact with these legacy types is necessary, so some degree of support should be maintained.
- Is there an opportunity to improve existing documentation on this subject?
- Yes, the deserializer returns undefined and the serializer ignores those values by default. The driver however defaults ignoreUndefined to false, so it mitigates that potential surprise.
Acceptance Criteria
Implementation Requirements
- None
Testing Requirements
- Add a test to assert JS undefined is returned when BSON contains deprecated undefined
- Assert ignoreUndefined=false inserts a BSON null for undefined values
- Organizational: find existing BSON undefined tests and move them to a file of that name.
Documentation Requirements
- https://www.mongodb.com/docs/drivers/node/current/fundamentals/bson/undefined-values/
- This page should clarify that undefined is returned from the driver when encountered
Follow Up Requirements
- WRITING-15419