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.
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.
- Create your MongoDB Atlas account.
- As soon as you login, it will walk you through building your first cluster - may take a few minutes to complete.
- 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.
- 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.
Connect to Your Cluster> click
connectin the sandbox window, and then click
connect your applicationin 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.
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
Thank you Dereje1 this was extremely helpful. Whitelisting all ip addresses fixed it.
I cannot establish connection to database.
var mongodb = require(‘mongodb’);
const mongoose = require(‘mongoose’);
“description”: “A boilerplate project”,
“start”: “node server.js”
I forgot to mention. I’m on Ubuntu 16.04.
see here first: MongoDB and Mongoose - Install and Set Up Mongoose
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…
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
I think all steps suggested in your links were taken. IP addresses where white listed.
Here is a link to my Glitch.
Great thanks in advance
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…
Thank you Good Sir. It’s working fine now.
good, I have merged your thread to the main one
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?
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!
thank you … i got stuck in the lessons instructions …
Thank you so much for this.
thanks, this was really helpful.
If your password in plain-text is
[email protected]'9'! , you would need to encode your password as:
I was stuck on this challenge too using Mongo Atlas. I had an ‘&’ in my MONGO_URI which made the process.env.MONGO_URI variable undefined. So I escaped the & by putting a \ before it and then my test passed.
My working MONGO_URI looks like:
If you notice that after “retryWrites=true” I put a slash before the &. This change helped my myApp.js read my process.env.MONGO_URI variable.