How to find MongoDB database name for URI

Tell us what’s happening:
Im currently trying to set up Mongoose and MongoDB but i am having an issue where MongoDB atlas is giving me a placeholder name (MyFirstDatabase) in my URI. I cannot connect to the cluster I need to connect to for this challenge because I have no idea what the name of the database I need to be accessing is. The FCC guide for this issue says this field should be automatically filled out like my username and cluster are, but the MongoDB site says I need to replace the placeholder name for my URI to work. Did I do something wrong to have a placeholder name there or am I just missing something else?

Current key looks like: ‘mongodb+srv://ZieServe:password@learnerscluster21.lce4d.mongodb.net/myFirstDatabase?retryWrites=true&w=majority’

(password isnt my real password obviously, just a placeholder for this post but i have my real one there on replit)
Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36

Challenge: Install and Set Up Mongoose

Link to the challenge:

You can leave the database name as it is or change it to whatever you like. If the database is there, your operations will work on the existing database. If not, a new one under the specified name will be create and your operations will be performed on the new database.
image_2021-06-17_021506
This is from one of my exercises. As you can see I didn’t change the default myFirstDatabase name.

There must be another reason why you can’t connect to atlas.
For instance, have you defined a user that has access?
Have you opened the necessary IP to connect to atlas?
Also in some cases, and that’s my personal experience, your local network may block ports that are used by mongodb. In such cases you need to use a VPN, or change local firewall settings, or deploy your application to somewhere outside of your network like replit to be able to connect to atlas.

Hope that helps.

1 Like

Thanks for the answer, You’re definitely right that that isnt my issue then and I already have the application running through replit… Ill have to do some digging around to see what the issue was… I have the network settings (for the database) such that all IP’s are authenticated (0.0.0.0/0) and have a user set up so its neither of those but always good things to check. I’ll probably try a few things and if they dont work, try again with a new cluster and replit fork just to make sure i didnt mess something else up unintentionally.

edit: omg… i had an extra set of quotation marks within the secret i stored the key in. Feeling very dumb :sweat_smile::joy::joy:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.