MongoDB and Mongoose - Install and Set Up Mongoose error. "mongoose" should be connected to a database

Hello everyone. I am stucked at this challange. I have created a database on MongoDB, and did everything they asked me. However I can’t find the error.
The code is the following:

.env file:

# Scrubbed by Glitch 2020-11-02T16:22:50+0000



const mongoose = require("mongoose");

and package.json:

  "name": "fcc-mongo-mongoose-challenges",
  "version": "0.0.1",
  "description": "A boilerplate project",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  "dependencies": {
    "express": "^4.17.1",
    "body-parser": "^1.19.0",
    "mongodb": "^3.6.1",
    "mongoose": "^5.10.11"
  "engines": {
    "node": "4.4.5"
  "repository": {
    "type": "git",
    "url": "!/project/welcome-project"
  "keywords": [
  "license": "MIT"

the output is the following:

// running tests
"mongodb" dependency should be in package.json (Test timed out)
"mongoose" should be connected to a database
// tests completed

I have to say that I am absolutely new to MongoDB, but still I can’t figure out what I did wrong. What do you think? I am going to put the glitch link as well (I am using the live App code and not the project page):

Thank you very much!

Hi, which challenge is this one?

Welcome, tricabit.

For future posts, 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 (’).

For this project, I recommend you debug, by console.loging things like:


Does this produce what you expect?

Are you sure about the URI you have?

Also, what does the Glitch logs say?

I notice you are not using the options suggested:

mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
1 Like

it is the first challange from MongoDB and mangoose. API and microservices course!

Do you have the angle brackets in your password? “< >” or the password is cipolla on it’s own?

Yes George I do! I just copied the URI from Mongo and replaced the words “password” and “DB name” shall I remove them?

I think you should remove the angle brackets <> from the URI.

Not sure what you have done there. I am not able to access the project link you have provided, and unfortunately, you are not providing any meaningful logs.

Tried my best.

thank you very much George!
the problem were the angle brackets!

for those who have the same problem: in the URI you must remove the angle brackets that you get from Mongo site!

in my case:


Nice one mate. Keep coding. Have a look in the logs next time, probably there was a message saying that the credentials are invalid.

1 Like