Install and Set up Mongoose problems

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 ?

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?

1 Like

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

1 Like

I am facing an issue in this challenge. In glitch, the connection looks fine, but when I am trying to pass the challenge Iam getting 3 times “not found” on the console. Stuck on this. Need help

You could’ve opened another topic :sweat_smile:

Anyway, post your code and someone will help: simply state the error doesn’t give much detail to understand what’s the problem ^^

:joy: thought of using the existing chain since I was going through different chains for this challenge. Anyway below is my code :

myApp.js :
var express = require(‘express’);
var app = express();
var bodyParser = require(‘body-parser’);
const mongoose = require(‘mongoose’);
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true });

package.json:
{
“name”: “fcc-learn-node-with-express”,
“version”: “0.1.0”,
“dependencies”: {
“express”: “^4.16.4”,
“body-parser”: “^1.15.2”,
“cookie-parser”: “^1.4.3”,
“mongoose”: “^5.3.13”,
“mongodb”: “^3.1.10”,
“connect-mongo”: “^2.0.2”,
“fcc-express-bground”: “https://github.com/Em-Ant/fcc-express-bground-pkg.git
},
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“engines”: {
“node”: “11.1.0”
}
}

.env :

SECRET=
MADE_WITH=
MONGO_URI=mongodb://pratiks77:XXXXXXXXXX@ds237748.mlab.com:37748/pratikdb

challenge console log :
// running tests

Not Found

Not Found

Not Found

// tests completed

I’m stuck and I have the same issues. It seem to be working but I get the three “Not Found” …