Hi. I am very sure that I have connected to the database successfully, but the test always said: “mongoose is not connected”. My codes added to myApp.js is:
var mongodb = require(‘mongodb’);
const mongoose = require(“mongoose”);
mongoose.connect(process.env.MONGO_URI, {useNewUrlParser: true});
The url in .env file is:
MONGO_URI=mongodb+srv://zhangxxx:518xxx@cluster0-hdkxo.mongodb.net/test
The package.json is:
"name": "fcc-mongo-mongoose-challenges",
"version": "0.0.1",
"description": "A boilerplate project",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.12.4",
"body-parser": "^1.15.2",
"mongodb": "^3.2.1",
"mongoose": "^4.3.0",
"dotenv": "^8.0.0"
},
"engines": {
"node": "4.4.5"
},
"repository": {
"type": "git",
"url": "https://hyperdev.com/#!/project/welcome-project"
},
"keywords": [
"node",
"hyperdev",
"express"
],
"license": "MIT"
}
I really think the test is wrong!!!