MongoDB and Mongoose - Install and Set Up Mongoose

Tell us what’s happening:

I cannot get my program to connect to the database, and I’m not sure how to go about troubleshooting. The Hint provided, and online resources have been unable to help.
Here is a snapshot of my workspace: Dashboard

Your code so far

const mongoose = require(‘mongoose’);
mongoose.connect(process.env.MONGO_URI);

Your browser information:

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

Challenge Information:

MongoDB and Mongoose - Install and Set Up Mongoose

Hi @legitmanley

Did you add the .env file?

Happy coding

Just to be clear, you can’t use the sample.env file, it has to be a file named .env

Yes there is a .env file, it should be in my snapshot, but I’m not entirely sure how they work. There is another forum post on this specific step and it is in line with everything I currently have, so I’m not sure where the problem lies.

I am aware of that, there is a .env file, it should be in my snapshot, but I’m not entirely sure how they work. There is another forum post on this specific step and it is in line with everything I currently have, so I’m not sure where the problem lies.

I assume you are the one that replaced the password in the connection string? Which is the correct thing to do when sharing the workspace, I’m just checking to make sure it isn’t actually what you are using.

Anyway, if I replace your connection string with my own, your code from the workspace you shared passes the test for me.