MongoDB and Mongoose - Install and Set Up Mongoose

Tell us what’s happening:

I have been trying for hours, read through all the forums and I still can’t seem to understand what’s wrong with it.

It kept on giving me the error:

    1. “mongoose” should be connected to a database

This are my codes:
.env

MONGO_URI=‘mongodb+srv://weird:Lm9fHhgjz6hquPA6@cluster0.bghfh.mongodb.net/apple?retryWrites=true&w=majority&appName=Cluster0’

myApp.js

const mongoose = require(‘mongoose’);
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

package.json

“dependencies”: {
“body-parser”: “^1.15.2”,
“dotenv”: “^8.2.0”,
“express”: “^4.12.4”,

###Your project link(s)

solution: https://3000-freecodecam-boilerplate-reu387950mk.ws-us117.gitpod.io

Your browser information:

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

Challenge Information:

MongoDB and Mongoose - Install and Set Up Mongoose

Hello, The instructions say mongoose is added to your project, but where is it? I don`t see it in the pkg.json.

“mongoose version ^5.11.15” dependency should be in package.json

You are also not using dotenv in the code you posted. You should keep the require('dotenv').config(); at the top of the file.

Share your Gitpod workspace to get more help as outlined on the challenge page.