Install and Set Up Mongoose issues

Install and Set Up Mongoose issues
0

#1

Hey having an issue with the first challenge in the Mongo section of Apis and Microservices. My package json looks like this:

{
  "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",
    "fcc-express-bground": "https://github.com/Em-Ant/fcc-express-bground-pkg.git",
    "mongoose": "^5.2.4",
    "mongodb": "^3.1.1"
  },
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "engines": {
    "node": "4.4.5"
  }
}

but when I run tests, all I get is 3 “Not found” errors. I’m really confused because I get no helpful error messages to show me what is wrong and I’m fairly certain my package.json has the dependencies correct. Any ideas?


#2

Your package.json looks fine. But have you done what’s asked in the rest of the instructions?

Then require mongoose. Store your mLab database URI in the private .env file as MONGO_URI. Connect to the database using mongoose.connect()?


#3

Hey @shimphillip, thanks for the reply.

I believe I have required mongoose correctly. I have this code in myApp.js:

var mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI);

and in my .env file I have included the URI:
MONGO_URI=‘mongodb://:@ds018248.mlab.com:18248/apimicroservices’


#4

This line looks bit off to me. You shouldn’t wrap the value with quotes. You also need to give user Id and password as part of the string.

Mine looks like this.

MONGO_URI=mongodb://shimphillip:[email protected]:35441/shimphillip


#5

Ok so after I formatted my URI to look like yours (removed the quotes and added userid and password of db on mlab) my test still fails. What’s weird is that I feel like 2 of the tests should still pass even if the URI was incorrect (if it’s looking for the mongoose and mongodb dependencies in my package.json why would those tests fail?) Not sure how to proceed at this point.


#6

I have the same problem. It came out that I didn’t fork the fcc initial proj.


#7

I’m facing the same issue. Looks like an authentication error but I can’t tell whats wrong.


#8

I think that’s my issue to: from what I can tell there is no link on the intro pages for that project I started modifying my earlier project from the express section. There is a link to mLab but no link to the glitch project boilerplate for the mongo challenges

Update: Never mind , the link is there on the last bullet point of the first section of the intro to the database excercises.


#9

Are you having this problem till now or you solve it ? plz tell me to see what to do


#10

I had the same issue and solved it this way:

  1. I used these versions
    “mongoose”: “^5.1.6”,
    “mongodb”: “^3.0.10”

  2. MONGO_URI=mongodb://myUser:[email protected]:55653/rashadd
    *there should be no spaces between “=” operator

Here in my Database in the “Users” tab I checked “Add database user” and added a new user and a new pass. I used this username and pass for connection in Glitch project and problem was solved