-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
As a Developer
I want the driver to use my injected os adapter.
So that I can collect client metadata in environments without a native Node.js os module.
User Experience
- Driver uses provided os adapter instead of require('os').
Acceptance Criteria
Implementation Requirements
- API Update: MongoClientOptions interface includes an optional, experimental property:
/** @experimental */ driverAdapters?: { os?: OsAdapter; }
- Resolution Logic:
- At options parsing time, resolve the provided options with defaults (nodejs OS module)
- Store the property in an accessible place on the MongoClient
- No Breaking Changes: The default path must result in the exact same native Node.js modules being loaded.
- Remove import: remove require('os') from all places inside src folder.
- Use os adapter provided with the mongo client options.
- Add `os` as a restricted eslint import
Testing Requirements
-
- Instantiate new MongoClient() (no options). Assert that client['runtime'].os is strictly equal to the native require('os') module.
- Instantiate new MongoClient(..., { driverAdapters: { os: mockOs }}). Assert that client['runtime'].os equals mockOs.
- ensure existing integration tests pass
Documentation Requirements
- n/a
Follow Up Requirements
- n/a
- related to
-
NODE-7378 Create dependency container for system and users-provided modules
-
- Closed
-