I was just giving you the true process you’d use to connect to your db, however in this case glitch takes care of your env file,
I read what you say but I dont understand this because I have no point of reference to know.
If you correctly set the connection string in the .env file of your glitch app then you can just use
process.env.MONGO_URI
to connect to your db, again look at that lesson I linked above on how to correctly set your env variables.
I read it a few times. I didnt see any new information that I did not already read or any new techniques that I did not attempt to utilize to get it to connect. I passed the challenges in that section, the challenge you referenced was easy to pass.
Right now you have hardcoded your connection string, which you shouldn’t do,
I think you mean that for security reasons ? well i tried doing the below as well but it doesnt work either :
mongoose.connect(process.env.MONGO_URI);
also your connection string is wrong, your app passes for me with a working connection string,
Why is the connection string wrong? I tried to connect using the second option ‘get a connection string and view driver examples’
see here how to correctly connect to the new mongoDB atlas:
MongoDB and Mongoose - Install and Set Up Mongoose Data
[/quote]
Is the below protocol incorrect ? Please advise:
https://github.com/freeCodeCamp/freeCodeCamp/blob/3218579479fa414f67915c663005548e252ccd8e/client/src/pages/learn/apis-and-microservices/mongodb-and-mongoose/index.md