-
Type: Task
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
NODE-3767 Description
What problem are you facing?
Trying to connect to mongodb+srv://username:password@somecluster/somedb?replicaSet=some-replica-set&connectTimeoutMS=10000&authMechanism=SCRAM-SHA-1&authSource=admin
The DBName is deleted because authSource in the URL exists, which results in the default dbName of the MongoClient to be set to "test". Removing authSource from the URL fixes the issue.
Apparently this was introduced in this commit: https://github.com/mongodb/node-mongodb-native/blob/ac445991a48b1c7b7a436a71fdad67c7b1cf9d4a/src/connection_string.tshttps://github.com/mongodb/node-mongodb-native/blob/main/src/connection_string.ts#L294
What driver and relevant dependency versions are you using?
4.2.0
Steps to reproduce?
const client = new MongoClient(mongoDbConnectionUri, this.options);
const db = client.db()
Any operations on db will always use 'test' as database name.
- is depended on by
-
NODE-3767 Default database name in URL is replaced by 'test' if authSource exists in connection string
- Closed