Mongoose can't be connected

Hey Guys I am trying to pass this challenge
but always give me the error

Mongoose is not connected

inspite of the rest two parts pass but this don’t that’s my code
for myApp.js

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

for 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.1.13",
    "mongoose": "^5.4.13"
    
    
	},
	"engines": {
		"node": "4.4.5"
	},
	"repository": {
		"type": "git",
		"url": "https://hyperdev.com/#!/project/welcome-project"
	},
	"keywords": [
		"node",
		"hyperdev",
		"express"
	],
	"license": "MIT"
}

this is also my .env file

# Environment Config

# store your secrets and config variables in here
# only invited collaborators will be able to see your .env values

# reference these in your code with process.env.SECRET

SECRET=
MADE_WITH=
MONGO_URI=mongodb://xxxx:xxxx@ds027017.mlab.com:27017/BabyHadeer
# note: .env is a shell file so there can't be spaces around =

I have put into consideration not putting special characters in the URL
ANY ONE HELP PLS

1 Like

Can you try putting that mongo url string right in the mongoose.connect?

mongoose.connect('mongodb://xxxx:xxxx@ds027017.mlab.com:27017/BabyHadeer');

That would eliminate one problem area. If that doesn’t work, try to connect with mlab straight from mongo, or better yet Compass if you have it installed.