-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: TypeScript
Use Case
As a user of the Node driver,
I want the Node driver to support async resource management,
So that so that I can use the explicit resource management proposal without workarounds.
Background
Ecmascript has moved explicit resource management to stage 3, and now major runtimes and bundlers are adding support for the helpers (examples include Nodejs, webpack, and Typescript).
Acceptance Criteria
POC containing runtime and TS logic, but no tests: https://github.com/mongodb/node-mongodb-native/pull/4177
- Add support for explicit resource management to all public driver constructs that have associated asynchronous cleanup logic:
- MongoClient
- Cursors
- ChangeStreams
- Sessions
- Configure API extractor to generate a `beta` namespace and mark all resource management interfaces and functions beta.
Testing
- Add smoke tests that compile the driver with resource management and confirm users can use async disposal semantics with the driver's resources
- Ensure all existing drivers tests pass.
- Add tests that confirm async resource management disposal methods call each resources' disposal methods.
- Add tests that ensure when the symbol is not defined, no disposal methods are added to driver resources.
Documentation Requirements
- File a ticket to have a reference manual page added to the Node driver reference docs demonstrating how to use explicit resource management with the Node driver