Install and Set Up Mongoose challenge failed

Does anybody has idea why I can’t meet the last requirement in the challenge even though there’s no error in Mongo set-up?

“mongoose” should be connected to a database

I really look forward your help. Thanks.


var express = require('express');
var app = express();
const mongoose = require('mongoose');
var Schema = mongoose.Schema;

  { useNewUrlParser: true, useUnifiedTopology: true },
  () => {
    console.log("Connected to MongoDB");

Your project link(s)

solution: boilerplate-mongomongoose - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36

Challenge: Install and Set Up Mongoose

Link to the challenge: textPreformatted text

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 (’).

1 Like

I forked and ran the code on Replit and it came back with a lot of errors, not too sure but it say`s your URL is not a string?

boilerplate-mongomongoose-1 - Replit

1 Like

I assume we would need the URI to his database, in his env info.

1 Like

Hi Kevin!

Thank you very much!

Hi Rob!

Thank you for your response. This is how I mentioned in .env


1 Like

The callback you are sending to connect receives an error message. Can we check that?

  err => {
    console.log("Connected to MongoDB", err);
1 Like

The error is Your app is listening on port 3000
Connected to MongoDB MongoParseError: Invalid scheme, expected connection string to start with “mongodb://” or “mongodb+srv://”

OK, then there is something wrong with your uri.

Is this what you have:

Ignoring the smart quotes for a second, that can’t be the right uri, can it?

1 Like

I’m not used to that schema, but that just looks wrong. Is it connecting when you run locally? Where did you get the uri?

1 Like

Secret tab > Open raw editor check if you see a double pair of quotes around the connection string. If so remove one of the pairs.

When you add the connection string on Replit it automatically adds quotes around the connection string.


Actually, I worked with this url for another 2 MERN applications but I don’t understand why it’s not working here

A big thank to all of you guys! At last it worked…

1 Like

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