bgardne7
bgardne7

Reputation: 93

Where do I find my database name and enter it into the mongoDB connection string?

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

Answers (2)

Haniel Baez
Haniel Baez

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

codemonkey
codemonkey

Reputation: 7905

In your Atlas panel, in the Clusters section of your project, click on this button: enter image description here

It will give you a list of your databases. If you have not created a database yet, click "Create Database"

enter image description here

Upvotes: 1

Related Questions