Mongo DB connection issues

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.

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": ""
    "keywords": [
    "license": "MIT"

this is my connection string in the secrets tab


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:

the database name is Cluster0 , replace test with it

Hi, Thanks for your reply. This doesn’t solve the issue though. I still get an error trying to connect. I have changed the connection string to this.


should be like this retryWrites=true&w=majority

Thanks, I tried that and it doesn’t work either

are you sure you have created dannyjebb user and you are using correct password

confirm you are using the user you have created for database user

Hi Yes, I had created a user and a password and given them full read and write access as well as allowing connections from all sources. I terminated the cluster and created a new one and it now works fine! Not sure what happend with the first. thanks for your help

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