-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Testing
How are you using Mongo? What version of the server and driver are you using?
Using the driver in a custom JS runtime
What is the feature/improvement you would like?
I want to add a test that proves the driver operates when these modules resolve to undefined.
kerberos: false, '@mongodb-js/zstd': false, '@aws-sdk/credential-providers': false, snappy: false, 'mongodb-client-encryption': false, socks: false, aws4: false, dns: false, http: false, saslprep: false, 'fs/promises': false, zlib: false, fs: false, path: false, // special case tls: false,
What use case would this feature/improvement enable?
This minimizes the surface area of the API needed to get a working driver without TLS and many other features the above modules provide.
Implementation ideas:
We have the logic in test/mongodb.ts that loads the legacy driver in a way that replaces the global require in a new vm context so we can customize where the 'mongodb' import come from. We can reuse this to provide a require that will return undefined for the above modules and use the returned client to run a few CRUD operations.
TBD on how much the driver should be able to do:
- auth? - Is saslprep required?
- tls? - Any prod env should have tls enabled, can all tls options be provided without 'fs'
- is related to
-
NODE-5120 Move zlib usage under conditional path that requires it
- Backlog