You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was added in #6106 in response to SRV connection strings lacking a database name, and thus the dbName workaround was added.
What is the expected behavior?
Now when testing with Atlas connection strings, it looks like we have the ability to specify a default database in the connection string - and parseConnectionString() successfully parses it.
The spec doesn't show this option, however Atlas uses it and even shows an example of defaulting to a test database in their Driver Examples documentation.
Thus, we believe the logic here should be (in this order):
if dbName is provided in the options, use it
if the database name is provided in the connection string (parsed as defaultDatabase), use it
if neither of the above are provided, default to the authorization database
Currently there is no step 2.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: 10.15
Mongoose: 5.4
MongoDB: 3.6
I'm working on a PR right now to add this logic and update these docs
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
When you connect to MongoDB, you provide a
dbName
option to specify which database to connect to. This is handled heremongoose/lib/connection.js
Lines 604 to 608 in 3e9faef
This was added in #6106 in response to SRV connection strings lacking a database name, and thus the
dbName
workaround was added.What is the expected behavior?
Now when testing with Atlas connection strings, it looks like we have the ability to specify a default database in the connection string - and
parseConnectionString()
successfully parses it.The spec doesn't show this option, however Atlas uses it and even shows an example of defaulting to a
test
database in their Driver Examples documentation.Thus, we believe the logic here should be (in this order):
dbName
is provided in the options, use itdefaultDatabase
), use itCurrently there is no step 2.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: 10.15
Mongoose: 5.4
MongoDB: 3.6
I'm working on a PR right now to add this logic and update these docs
The text was updated successfully, but these errors were encountered: