-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.0.2
-
Empty show more show less
The latest driver seems to have a problem with the case whereby the auth database and the database being connected to are different, or at least it seems to be a problem from 3rd party systems such as Mongoose when using the 3.6 URI syntax.
The MongoDB Atlas, says that even on a v3.6 compliant driver I should use the /mytestdb syntax to set my database name even though I authenticate against the admin database as shown in the example below:
mongodb+srv://test-user:3#f!69A8AZu9@cluster0-abcde.mongodb.net/mytestdb
In the case of Mongoose they use the MongoDB driver library url_parser to parse the URL and get the DB name. In the latest version of the driver this seems to return 'admin'.
If I use the 3.4 syntax as shown below it seems to work fine:
mongodb://test-user:3#f!69A8AZu9@cluster0-shard-00-00-abcde.mongodb.net:27017,cluster0-shard-00-01-abcde.mongodb.net:27017,cluster0-shard-00-02-abcde.mongodb.net:27017/mytestdb?ssl=true&replicaSet=cluster0-shard-0&authSource=admin
I am not sure if you would consider this a bug as it does not seem that the URL Parser is supposed to be a public API, but the url_parser does seem to have code that tries to set dbName to something other than its default of 'admin' in certain cases, and it works for the 3.4 syntax so I am assuming it is a bug.
- is related to
-
NODE-1304 Use the connection string parser from mongodb-core in native
- Closed