MongoDB and Mongoose - Install and Set Up Mongoose Duplicate

For some reason, despite looking at relevant similar posts, I cannot find a solution. Any help is appreciated.

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

}

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://username:password@ds017231.mlab.com:17231/learningdatabase

note: .env is a shell file so there can’t be spaces around =

In MyApp.js, I just want to do const mongoose = require(“mongoose”) to no avail. :frowning:

I think your stuck is here :point_up_2:.

The semantic versioning is: MAJOR.MINOR.PATCH

Remember the NPM packages challenges.

HI Yoelvis. Thank you for the reply. Even when I put 5.1.6 for example it does not work. I tried looking up compatible mongoose versions for mongodb to get the minor right but idk what’s wrong.

The last version of mongoose is 5.4.6
Fix this to a valid version.

:thinking: Is your database connected with mongoose.connect?

Well the Logs Button shows a red error logo when I simply try to require mongoose (const mongoose = require(“mongoose”). ^5.1.6 covers 5.4.6 or am I mistaken? EIther way, nothing seems to work :frowning:

:man_facepalming: Follow the instructions:

  • Create an mLab account.
  • Create a free online database.
  • Create a new admin user on the database, so you can access it.
  • Get the mLab URI, which you will use in your application to connect to your database.

More in this introduction

Important: Your mLab URI is secret.

Yeah that’s not my actual MLab URI. I put username and password in this post bc i ddnt want to expose everything. So I did put mine in the .env file and stuff but it won’t work.

Turns out the version for mongodb was ^3.1.13 as found on npm website lol. I thought it was the version of the database on mlab website. Thanks anyways man.