Install and Set up Mongoose problems

Install and Set up Mongoose problems
0

#1

Install and Set up Mongoose problems

I’m getting the mongoose is not connected message on running the test.
Mongodb and mongoose dependencies are okay.

Relevant code :
in the . env :
MONGO_URI=mongodb://:@ds123790.mlab.com:23790/yakdatabase

in myapp.js:
var mongoose = require(“mongoose”);
mongoose.connect(process.env.MONGO_URI);

in package.json :
“dependencies”: {
“express”: “^4.12.4”,
“body-parser”: “^1.15.2”,
“mongodb”: “^3.6.6”,
“mongoose”: “^5.1.6”
},

Help appreciated. username and password to connect to mLab seem okay. Any quick way to validate this ?


#2

Uhm, are you sure about the second colon?

mongodb://:@ds123790.mlab.com:23790/yakdatabase

Watching one old string of mine i had my username right after the //, followed by that colon , my password a then the rest.
Something like that ( just randomly changed the password ;P):

“mongodb://layer:#SpreeAfterThat44#@ds125341.mlab.com:25341/cottonDB”,

One last thing: where that myapp is running? Did you checked if it can read the value of process.env.MONGO_URI?


#3

thanks for the input. Was gonna pull my hair out. Finally figured out username and password should not be within <>. duh…lol.