Unable to run index.js

I have followed the steps mentioned in the Readme file perfectly, but when I run npm start, I get an error.
Screenshot%20from%202019-01-09%2013-18-18

Hi C_C_Darshan_59096,

As the error suggesting, please check if you are able to connect to your Atlas cluster: ping xxx.mongodb.net.

  • If you are unable to connect, check for IP whitelisting
  • OR if your network is blocking the request.
  • Also, check if port 5000 is free to use.

Let me know.

Kanika

Thank you for getting back to me,
It seems I’m unable to connect to the mongodb atlas instance. Previously I was successful in connecting and even restored the data using mongorestore.
Now for some reason, I’m unable to connect to the instance. I even deleted the project and started from scratch, still doesn’t work.
Please help me out.

Hi ,

I am able to connect just fine. What is the message you are seeing after you run:

 ping cluster-xxxx-.mongodb.net

Correction: Please try to ping your atlas cluster string.

If it says timed out.

Then check if firewall is blocking the request.

Kanika

ping cluster0-shard-00-00-jxeqq.mongodb.net

Seems to be working fine.

Sorry! Please try connecting to your atlas cluster the same way and share the output.

Kanika

Oh my bad,
Works the same.

Looks like it was an issue with me DNS configuration. The issue is resolved.
Thank you.

1 Like

HI I am confused with the process of importing data to cluster using mongorestore
Please can you help me?

Make sure you are at the root of the folder : mflix-js (unless you have changed it ). Then use the following command to restore the data:

mongorestore --drop --gzip --uri \ "mongodb+srv://m220student:m220password@<YOUR_CLUSTER_URI>" data

It takes about 5-10 mins for the whole process.

My real Problem is about the command
mongorestore --drop --gzip --uri \ “mongodb+srv://m220student:m220password@<YOUR_CLUSTER_URI>” data
I replaced “mongodb+srv://m220student:m220password@<YOUR_CLUSTER_URI>” data
with my SRV string connection(Image below)

but it did not work, please can explain to me what shall I Do?

It looks like while choosing a connection method, you are choosing Connect with Mongo Shell.
Instead, choose Connect Your Application.
And then choose the Short SRV Connection string option to show your connection string.
Use this in the mongorestore --drop --gzip --uri \
"<Connection String>" data.

Do not forget to enclose the connection string in double quotes and data at the end of the command.

I faced the same issue “Error: querySrv ENOTFOUND”.
In my case this happened because of enabled VPN. Once I disconnected it, it started working fine.

Hi everyone, I’m also having the same error upon running npm start:

Error: querySrv ENOTFOUND _mongodb._tcp.flix-vknlo.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:195:19)

How do I solve this in order to start the application? I’ve attempted to follow the previous solution as suggested by Kanika with Curriculum Support. But I truly have not idea how to solve this problem. Please advise.

UPDATE: The error was due to the fact that I used the wrong URI string. When setting up your application with Atlas as per the README.rst file, be sure to copy the URI string found under the second option on the “Connect Your Application” modal. See image:

49%20PM

I’m having the same error. How exactly were you able to get your application to run? I ran the ping command and it had the same 64 bytes from mflix ... output. But my application is still not able to run due to the error.

UDPATE: It turned out that I used the wrong URI string. See original query in thread for full details.

2 Likes