Lab 1.1: Install Course Dependencies - not able to connect to M201 DB

Team,
I was able to connect to the M201 databases through MongoDB shell from the command promt using the below connection string:
mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,localhost:27017”
It was working a few days before. I was able to access the M201 DB using the compass as well. But, right now I am not able to connect and getting the below error:

MongoDB shell version v4.0.9
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,localhost:27017/?gssapiServiceName=mongodb
2019-05-26T11:19:04.333+0530 E QUERY [js] Error: couldn’t connect to server localhost:27017, connection attempt failed: SocketException: Error connecting to localhost:27017 (127.0.0.1:27017) :: caused by :: No connection could be made because the target machine actively refused it. :
connect@src/mongo/shell/mongo.js:343:13
@(connect):2:6
exception: connect failed

Can you please let me know what mistake I have in the connection string.

Regards
Pradeep

1 Like

Are you using a local cluster or an Atlas cluster? Because your connection string has a mixture of both, which is rather odd.

If that’s really what you want to do, then it’s localhost that the error message is complaining about, so you could check whether the MongoDB Server service is running on your local machine, and start it if it isn’t.

Or you could check out the newer DNS Seedlist connection string format, which is simpler because it only requires a single hostname and lets the server take care of where all the individual nodes are.