How to Install and Set Up Mongoose HELP PLEASE

I am having major issues with this project I have viewed all videos on this subject in repl.it I know they do not use .env file we have to use secrets however I can get my code to pass the last test here is my code

require('dotenv').config();

const mongoose = require('mongoose');

mongoose.connect('process.env.MONGO_URI', { useNewURIParser: true, useUnifiedTopology: true });

“mongodb” dependency should be in package.json
passed

“mongoose” dependency should be in package.json
passed
“mongoose” should be connected to a database
<can not connect to this have tried several times I di the secrets .env file correctly >

any help would be great and if I am missing any info please let me know first time posting here than you

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Can you try sharing your replit link?

yes and thank you for the support : )

let me know if this works

could the issue be with how I set up mongoose Database deployment?

I found two issues.

No.1:
It should be process.env['MONGO_URI']
Not 'process.env.MONGO_URI'

No2:
You need to make sure you are using the correct versions for mongoose and mongo.

Here are the fcc instructions again.
Add mongodb@~3.6.0 and mongoose@~5.4.0 to the project’s package.json .

Give that a try

will do i will let you know if this works thank you

YESSSSSSSSSSSS it passed thank you sooooooooo much you are a ROCKSTAR Jwilkins.oboe

1 Like

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