-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
Use Case
As a Node driver engineer,
I want to prevent users from providing sessions from one mongo client to another,
So that we can prevent undefined behavior for our users.
User Impact
- Breaking Change Users passing sessions started on other clients will now have errors thrown from operations
Dependencies
- None
Unknowns
- should we throw an error if the user provides a session from one client to another? or should we silently create an implicit session?
- errors will make it incompatible with existing code but that's why we are putting this out in a major version
- best way to identify client? - instanceof is brittle, we can generate a unique id and/or use a symbol property; needs to account for legacy client usage
- what other identifier is there?
- what problems are there with checking referential equality?
Acceptance Criteria
Implementation Requirements
- when an explicit session is provided to a driver helper, do not attach the session to the operation if it originates from a different mongo client instance
- Check client reference on session against reference passed to executeOperation
Testing Requirements
- Implement prose test 5 from the sessions spec
- Consider additional unit tests for specific error scenarios if prose test is unable to include the correct coverage (message/error type)
Documentation Requirements
- Update startSession API documentation to mention this requirement
Follow Up Requirements
- None
- related to
-
NODE-4896 serverless tests hang [21]
- Closed