Install and setup Mongoose

Tell us what’s happening:
Describe your issue in detail here.

Ok so I did the Read Search Ask and went thorugh like a dozen posts and YT videos and I still can’t figure out why it’s not passing.

I put this in myApp.js

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

and I got the first 2 tests to pass…then only one passed now?

Then I typed install mongoose into the command line.

And I created a secrets file with what I think are the correct values?

Your project link(s)

solution: https://replit.com/@tai-anan/boilerplate-mongomongoose-3

Your browser information:

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

Challenge: Install and Set Up Mongoose

Link to the challenge:

In replit there is a lock emblem next to some of your files in your build. You click on that and that is where your “secrets” variables go. The key should be MONGO_URI and the value should be set to the uri that you were provided with your MongoDB cluster. The uri they give you from Mongo will look a lot like this mongodb+srv://<this is your username>:<password>@cluster0.g5r35.mongodb.net/myFirstDatabase?retryWrites=true&w=majority.
The actual value of it should look something like this mongodb+srv://myusername:mypassword@cluster0.g5r34.mongodb.net/myFirstDatabase?retryWrites=true&w=majority.
The instructions were a little tricky for the challenge because i could swear they say in replit to add single quotes to the uri when setting it as the value to the MONGO_URI key. But i found that adding single or double quotes caused it not to connect. So when storing your uri value to the MONGO_URI key, make sure you add it as copied from the mongo database when they gave it to you to connect to your cluster and pass in the your password as password to the uri where it indicates <password> make sure to remove the < and > from the uri. Then try to reconnect. This assumes you already set up a mongoDB database with the free cluster.

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