Tell us what’s happening:
Describe your issue in detail here.
I am trying to complete the first challenge in the mongoDB section, I have created my DB and used the connection string in my secrets tab on replit, but I get the following error.
I set up my mongoDB as per the directions on the challenge. I have changed the <password>
to my actual password on the connection string.
require('dotenv').config();
const mongoose = require('mongoose');
const mySecret = process.env['MONGO_URI'];
mongoose.connect(mySecret, { useNewUrlParser: true, useUnifiedTopology: true });
{
"name": "fcc-mongo-mongoose-challenges",
"version": "0.0.1",
"description": "A boilerplate project",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "^1.15.2",
"dotenv": "^8.2.0",
"express": "^4.12.4",
"mongoose": "~5.4.0",
"mongodb": "~3.6.0"
},
"repository": {
"type": "git",
"url": "https://github.com/freeCodeCamp/boilerplate-mongomongoose.git"
},
"keywords": [
"node",
"mongoose",
"express"
],
"license": "MIT"
}
this is my connection string in the secrets tab
mongodb+srv://dannyjebb:*********@cluster0.tguba.mongodb.net/test?retryWrites=true
On the setup instructions it says that after the URL as been entered, you should add the name of your database after / and before the first parameter… I dont see a name for the database anywhere though. and the connection string that mongoDB gives me doesnt include one.
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
Your project link(s)
solution: boilerplate-mongomongoose - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Challenge: Install and Set Up Mongoose
Link to the challenge: