MongoDB and Mongoose - Install and Set Up Mongoose bamboozled

Tell us what’s happening:
I get this:
“mongoose” should be connected to a database
Your code so far

  "name": "fcc-mongo-mongoose-challenges",
  "version": "0.0.1",
  "description": "A boilerplate project",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  "dependencies": {
    "express": "^4.16.4",
    "body-parser": "^1.19.0",
    "mongodb": "^3.3.2",
    "mongoose": "^5.7.4",
    "connect-mongo": "^2.0.3"
  "engines": {
    "node": "8.x"
  "repository": {
    "type": "git",
    "url": "!/project/welcome-project"
  "keywords": [
  "license": "MIT"


var mongodb = require('mongodb');
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI,{useNewUrlParser: true});

and .env:


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36.

Challenge: undefined

Link to the challenge:

Have you solved this yet? You might not be using the correct username/password for this database. This is from the logs:

(node:726) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [] on first connect [MongoError: bad auth Authentication failed.]

Isn’t username/password the same? I only got that one db

1 Like

Have you set a user for that db?

Should I add a user besides the default atlasAdmin@admin?

Try adding a new user.

1 Like

Works with a new user. I don’t get it why. Thx anyway