I tried a lot to execute the tests in db-connection.test.js but none of the three tests are passing, the env variables in .env file are correct and I have tried connecting to mongo using shell. Not sure what’s the problem, I tried some of the solutions which have worked for other students for the same problem, but they don’t work for me. Please suggest!
Can you share a screenshot of the error you are getting?
And double check your connection string and username and password. But Im sure you have already lol
This is the .env :
So those are the tests; not the error.
However, I tried to connect to your cluster and got the error about
** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network
Have you made sure to follow all the steps in the README.rst file about setting up your Atlas Cluster?
Update your IP Whitelist so that your app can talk to the cluster. Click the
Security tab from the Clusters page. Then click IP Whitelist
followed by Add IP Address. Finally, click Allow Access from Anywhere
and click Confirm.
How did you try to access my cluster? I have followed the steps, I can access the database through any IP address.
Exactly, I don’t know know what the error is, but when tried to debug, I realized it’s just not able to connect to the database.
Did you check the config of .env that I had shared previously? Is there any problem? What is MFLIX_NS?
which gives me the error about Whitelisting your IP.
So you are sure you have Whitelisted your Ip? And if unsure just use 0.0.0.0 which whitelist all ips. And you have renamed the file to
.env I see.
However My course lab says that
MFLIX_NS=mflix not sample_mflix
Maybe try that.
You will not be able to access that cluster without the correct username and password. LOL
I tried with mflix as well instead of sample_mflix. But it still doesn’t work.
@Kanika Can you please help?
Please check the contents of your
.env file and make sure MFLIX_NS is set to
Also, please share here the information like
.env contents if you are unable to solve the issue.
Try connecting the cluster from your terminal to make sure you have IP whitelisted and firewall is disabled, so that we know your system can communicate with the cluster.
Also, make sure the data is imported successfully into your cluster before running the unit tests.
I think you will have to share a screenshot of the error you are getting. Or share the actually contents of the .env to help figure out what the error is.
Or run the tests with the argument
Hey Kanika and Sean, here are the contents of my .env file :
I am able to connect to my cluster through CLI by using the same URI and the sample data is also imported successfully.
There seems to be an issue here regarding the database name. The data you might have imported is having name
sample-mflix and database name in
Thanks for notifying the issue and I am in process of fixing it.
Meanwhile, I have reimported data in your cluster under the correct name: sample_mflix. Please check if you are able to pass the test now.
Nice catch I did not notice that.
Epic face palm!