Tell us what’s happening:
Hello everyone, I got stuck on the Install and Set Up Mongoose challenge.
I am getting the same error “mongoose should be connected to a database” when trying to submit a solution.
I read through several topics on the same problems, but none of the solutions seems to work in my case.
My app.js_______________________________
require("dotenv").config();
let mongoose = require("mongoose");
mongoose.connect(process.env.MONGO_URI, {
urlEncoded: true,
useNewUrlParser: true
});
I tried to put mongoose.connect inside a var but its no hepl
.env file___________________________________
MONGO_URI=mongodb+srv://myUsername:myPassword@cluster0.rmycu.mongodb.net/myFirstDatabase
Where myUsername and myPassword are changed to username and password, I am not using any prohibited symbols in them.
Any help and advice appreciated
Your project link(s)
solution: https://4gfgo.sse.codesandbox.io
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36
Challenge: Install and Set Up Mongoose
Link to the challenge: