Mongo db URI instructions possibly out of date

Tell us what’s happening:
In the first set of instructions from Back End Development and APIs
MongoDB and Mongoose there is a line detailing how to save the mongoose database URI that reads
Be sure to surround the URI with single or double quotes
I couldn’t get the solution to compile with quotes surrounding the URI, however it works as expected without the single or double quotes.

Your project link(s)

solution: https://replit.com/@codywaukee/boilerplate-mongomongoose

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Install and Set Up Mongoose

Link to the challenge:

.env is a hidden, not javascript, but shell file. There must be no quotes surrounding the string.

If the URI is included in a js script file instead, then the quotes are mandatory.

However, adding a URI in the JS file will let other users know details about your MongoDB cluster.

santimir thanks for the reply. That makes sense. I’m saying the instructions are unclear and leave me to believe that I should be wrapping the .env value in a quotes.
Create a .env file and add a MONGO_URI variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the = in environment variables. For example, MONGO_URI='VALUE'. When you are done, connect to the database using the following syntax:

@codywaukee tbh this exercise’s spelling has always been a mess. But still…

Just make sure you take something away from it, like how to connect to a MDB database, what is a MDB-connection-URI string and what pieces it has to have.

I was also wondering why not to put double quotes, which is a standard in shell for defining variables.

This is actually because the package dotenv has parsing rules.

Good luck!

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