mongodb-js / connection-model

MongoDB connection model.
Apache License 2.0
10 stars 5 forks source link

fix: safe async parsing of connection strings #316

Closed mcasimir closed 4 years ago

mcasimir commented 4 years ago

Description

Internal use of async/await and promises in Connection.from to simplify the code and properly deal with the asynchronous parsing in case of errors.

NOTE: we are also dropping the "normalisation" of the scheme (adding the scheme if not present). Since the url scheme is validated in compass-connect that feature is never used, also not behaving properly:

http://my-host --> mongodb://http://my-host
bad-protocol://somehost?#mongodb+srv:// --> bad-protocol://somehost?#mongodb+srv://

To be precise this should probably be a new major version.

Checklist

Motivation and Context

Open Questions

Dependents

Types of changes