MongoDB and Mongoose - Install and Set Up Mongoose

MongoDB and Mongoose - Install and Set Up Mongoose
0
#25

#26

@mscanza, I’ll do a test run later this evening, if no one hasn’t got to it by then…

#27

im having the same issue as user @mscanza. That you have to use Mongo Atlas meaning i can’t follow the instructions in the challenge. Does anyone know when the (apis-and-microservices) challenges will be updated or a quick fix to be able to complete the challenge? Thank you.

#28

I have just confirmed that the lessons still work even after the changes made from the acquisition of mlab by mongodb, these instructions need to be fully changed however, I will look to submitting a PR or see if one hasn’t already been submitted.

But, it should not stop anyone from continuing with the lessons, since the instructions in MongoDB Atlas are pretty clear, see below for brief instructions or go to this link for a more detailed set of instructions from a PR of the lesson that is pending approval.

  1. Create your MongoDB Atlas account.
  2. As soon as you login, it will walk you through building your first cluster - may take a few minutes to complete.
  3. Then following the green tab in the bottom left of the screen, click on Create your first database user, follow the instructions and create a user with a password.
  4. In the same green Get started tab click on Whitelist your IP address, warning here, glitch will not connect if you don’t allow all IP addresses, which is what I did for it to work.
  5. Click Connect to Your Cluster > click connect in the sandbox window, and then click connect your application in the pop up window, then copy the connection string, and paste it in your .env file in glitch and substitute the password you provided in step 3 for the <password> area , and you are good to go. Test the first lesson and it should pass.

Update
mongoDB Atlas says it requires MongoDB version 4.0 for the free tier clusters . If you are using Mongoose, this means that you would need mongoose > 5.2 to have a compatible mongoDB driver that Atlas can use

Submit the link to your LIVE page from glitch for the challenge to pass and not the link to your glitch editor

9 Likes
Install and Set Up Mongoose - Won't connect to database
mongoDB and glitch (URL shortener)
MongoDB and Mongoose - Mongoose is not connected
2MongoDB and Mongoose - Install and Set Up Mongoose need HELP!
How to continue with Apis and Microservices's MongoDB and Mongoose challenges now that mlab doesn't accept any registrations?
MongoDB and Mongoose - Install and Set Up Mongoose-error
#29

Thank you Dereje1 this was extremely helpful. Whitelisting all ip addresses fixed it.

#30

Hi Team,

I cannot establish connection to database.
My code:
.env file
Screenshot%20from%202019-03-14%2018-52-12

myApp.js
var mongodb = require(‘mongodb’);
const mongoose = require(‘mongoose’);
mongoose.connect(process.env.MONGO_URI,{useNewUrlParser: true});

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.16.4”,
“body-parser”: “^1.18.3”,
“mongoose”: “^5.4.19”,
“mongodb”: “^3.1.17”
},
“engines”: {
“node”: “4.4.5”
},
“repository”: {
“type”: “git”,
“url”: "
},
“keywords”: [
“node”,
“hyperdev”,
“express”
],
“license”: “MIT”
}
Please help!!!

#31

My console output

#32

I forgot to mention. I’m on Ubuntu 16.04.

#33

see here first: MongoDB and Mongoose - Install and Set Up Mongoose

1 Like
#34

Thanks for the reference Dereje1. I’m a little bit confused here. I tried to change dependencies version and it did not work out. If you know the trick, please tell…

#35

Did you whitelist all ip addresses in MongoDB atlas as pointed out in the link I gave you ?
If you followed the instructions I posted above and still can’t get it to work post your glitch link and i’ll look into it

#36

Hey Dereje1,
I think all steps suggested in your links were taken. IP addresses where white listed.

.

Here is a link to my Glitch.
ttps://glitch.com/edit/#!/orchid-purple?path=.glitch-assets:1:0
Great thanks in advance

#37

If you click on allow all ip addresses you should see 0.0.0.0/0 (includes your current IP address) included in your ip address list, which means you may not have done it correctly. Your glitch app connects fine for me with my own connection string…

2 Likes
#38

Thank you Good Sir. It’s working fine now.

#39

good, I have merged your thread to the main one

#40

Hi, I’ve encountered an issue with this exercise. I believe my code is correct, however when I submitted my solution, all the tests failed, and I saw this error message on the Chrome console:

“Access to XMLHttpRequest at ‘/package.json’ from origin ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

Does anyone know how I can fix this?

#41

thanks for the tip on allowing all ip addresses on glitch, i was running around in circles trying to figure out why it wasnt working!

#42

thank you … i got stuck in the lessons instructions …

#43

Thank you so much for this. :slight_smile:

1 Like
#44

thanks, this was really helpful.