Tell us what’s happening:
I am trying to do the MongoDB tutorial, but can’t pass the first challenge. It is not seeing the dependencies in my package.json or that I’m connected to mongodb.
I know that my code is right because I can see sample stuff up in the database.
I have tried pasting both
https://repl.it/@CactusWren2020/GiftedLankySoftwaresuite#myApp.js
and
https://GiftedLankySoftwaresuite--five-nine.repl.co
in the Solution Link input and neither works.
Your code so far
var express = require('express');
var app = express();
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
/*const Cat = mongoose.model('Cat', { name: String });
const kitty = new Cat({ name: 'Meowster' });
kitty.save().then(() => console.log('meow'));
*/
{
"name": "fcc-learn-node-with-express",
"version": "0.1.0",
"dependencies": {
"express": "^4.14.0",
"body-parser": "^1.15.2",
"cookie-parser": "^1.4.3",
"mongodb": "^3.6.3",
"mongoose": "^5.10.13",
"fcc-express-bground": "https://github.com/freeCodeCamp/fcc-express-bground-pkg.git"
},
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"engines": {
"node": "4.4.5"
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
.
Challenge: Install and Set Up Mongoose
Link to the challenge: