Reputation: 93
I think there is a very simple answer to this but I've run into this issue twice now. I have my connection string as:
"mongodb+srv://USERNAME:[email protected]/DATABASENAME?retryWrites=true&w=majority"
I've entered my USERNAME and PASSWORD, but what do I enter for DATABASENAME? I know it seems obvious that I should enter the name of my database, but I don't see anything that literally says Database on my mongoDB-atlas project. I've entered my project name but it does not work and the tutorials I see on YouTube all vary just enough to not give me a clear answer to this seemingly simple question.
Upvotes: 1
Views: 2105
Reputation: 1690
MongoDB authenticate at database level, so you root
user should be authenticated at the admin
database.
"mongodb+srv://USERNAME:[email protected]/admin?retryWrites=true&w=majority"
Why database level? Because a user can have privileges across different databases; that is, a user’s privileges are not limited to their authentication database.
Upvotes: 0
Reputation: 7905
In your Atlas panel, in the Clusters section of your project, click on this button:
It will give you a list of your databases. If you have not created a database yet, click "Create Database"
Upvotes: 1