Tell us what’s happening:
I’m getting starting on the API’s and Microservices section and setting up MongoAtlas. The MongoAtlas appears to have changed (I never saw a green button in the lower left hand) but after clicking around I eventually worked through the steps and was able to check off all the steps and get the URL to use in the .env file. However, after working through the next set of instructions (even after copying the solution code) the submission fails with the following result.
// running tests “mongodb” dependency should be in package.json (Test timed out) “mongoose” dependency should be in package.json (Test timed out) “mongoose” should be connected to a database (Test timed out) // tests completed
“mongodb” dependency should be in package.json
“mongoose” dependency should be in package.json
“mongoose” should be connected to a database
Your code so far
.env file (with password removed)
reference these in your code with process.env.SECRET
SECRET=
MADE_WITH=
const MONGO_URI=‘mongodb+srv://wvaldes:*****@cluster0-ls0xp.mongodb.net/test?retryWrites=true&w=majority’
// QUESTION: Is the URI supposed to be contained in quotes or not?
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.12.4”,
“body-parser”: “^1.15.2”,
“mongodb”: “^3.0.0”,
“mongoose”: “^5.6.5”
},
“engines”: {
“node”: “4.4.5”
},
“repository”: {
“type”: “git”,
“url”: “https://hyperdev.com/#!/project/welcome-project”
},
“keywords”: [
“node”,
“hyperdev”,
“express”
],
“license”: “MIT”
}
myApp.js
/**********************************************
-
- FCC Mongo & Mongoose Challenges
- ==================================
*******************************************/
/ # MONGOOSE SETUP #
/ ================== /
/ 1) Install & Set up mongoose */
// Add mongodb and mongoose to the project’s package.json. <=Done
// Then require mongoose. <=Done
const mongoose = require(‘mongoose’);
// Store your Mongo Atlas database URI in the private .env file as MONGO_URI.
// Connect to the database using the following syntax:
// mongoose.connect(, { useNewUrlParser: true, useUnifiedTopology: true });
mongoose.connect(process.env.MONGO_URI);
//QUESTION: Should I use { useNewUrlParser: true, useUnifiedTopology: true } or not?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
.
Challenge:
MongoDB and Mongoose - Install and Set Up Mongoose
Link to the challenge:
Link to my Glitch submission:
https://strengthened-fair-shawl.glitch.me as of 4/19/2020