Not able to connect to atlas - error connecting to atlas

C:\Users\vgarg>mongo “mongodb+srv://cluster0-vx0v3.mongodb.net/test” authenticationDatabase admin --ssl --username m001-student --password m001-student-basics
MongoDB shell version v4.0.12
connecting to: mongodb://cluster0-shard-00-01-vx0v3.mongodb.net.:27017,cluster0-shard-00-02-vx0v3.mongodb.net.:27017,cluster0-shard-00-00-vx0v3.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2019-08-14T10:47:22.635-0700 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-01-vx0v3.mongodb.net.:27017,cluster0-shard-00-02-vx0v3.mongodb.net.:27017,cluster0-shard-00-00-vx0v3.mongodb.net.:27017
2019-08-14T10:47:22.829-0700 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00-vx0v3.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-00-vx0v3.mongodb.net.:27017 with a 5 second timeout)
2019-08-14T10:47:22.830-0700 I NETWORK [js] Successfully connected to cluster0-shard-00-01-vx0v3.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01-vx0v3.mongodb.net.:27017 with a 5 second timeout)
2019-08-14T10:47:22.855-0700 I NETWORK [ReplicaSetMonitor-TaskExecutor] changing hosts to Cluster0-shard-0/cluster0-shard-00-00-vx0v3.mongodb.net:27017,cluster0-shard-00-01-vx0v3.mongodb.net:27017,cluster0-shard-00-02-vx0v3.mongodb.net:27017 from Cluster0-shard-0/cluster0-shard-00-00-vx0v3.mongodb.net.:27017,cluster0-shard-00-01-vx0v3.mongodb.net.:27017,cluster0-shard-00-02-vx0v3.mongodb.net.:27017
2019-08-14T10:47:22.989-0700 I NETWORK [js] Successfully connected to cluster0-shard-00-00-vx0v3.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-vx0v3.mongodb.net:27017 with a 5 second timeout)
2019-08-14T10:47:23.008-0700 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02-vx0v3.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02-vx0v3.mongodb.net:27017 with a 5 second timeout)
2019-08-14T10:47:23.154-0700 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01-vx0v3.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01-vx0v3.mongodb.net:27017 with a 5 second timeout)
2019-08-14T10:47:23.188-0700 I NETWORK [js] Marking host cluster0-shard-00-00-vx0v3.mongodb.net:27017 as failed :: caused by :: Location40659: can’t connect to new replica set master [cluster0-shard-00-00-vx0v3.mongodb.net:27017], err: Location8000: bad auth Authentication failed.
2019-08-14T10:47:23.385-0700 I NETWORK [js] Marking host cluster0-shard-00-02-vx0v3.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-02-vx0v3.mongodb.net:27017 :: caused by :: bad auth Authentication failed.
2019-08-14T10:47:23.591-0700 I NETWORK [js] Marking host cluster0-shard-00-01-vx0v3.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-01-vx0v3.mongodb.net:27017 :: caused by :: bad auth Authentication failed.
2019-08-14T10:47:23.829-0700 I NETWORK [js] Marking host cluster0-shard-00-00-vx0v3.mongodb.net:27017 as failed :: caused by :: Location40659: can’t connect to new replica set master [cluster0-shard-00-00-vx0v3.mongodb.net:27017], err: Location8000: bad auth Authentication failed.

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2019-08-14T10:47:23.832-0700 E QUERY [js] Error: can’t authenticate against replica set node cluster0-shard-00-00-vx0v3.mongodb.net:27017 :: caused by :: can’t connect to new replica set master [cluster0-shard-00-00-vx0v3.mongodb.net:27017], err: Location8000: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed

1 Like

Hey @Vipin_Garg_91754

Are you trying to connect to your Atlas Cluster or the Class Atlas Cluster.

If your Atlas cluster have you made sure to whitelist 0.0.0.0 Ip as instructed?

And see this post for additional help

Hi Yes,

Correct that I Am trying to connect to Atlas cluster and I do have 0.0.0.0/0 in IP white list as instructed.
I am not able to connect to Atlas

Another question is that, where do I see information on ? What is the command to display this information

Hostname:
Username:
Replica Set Name:
Read Preference:

Lecture Notes of the videos

Guys, I am stuck on " Your Sandbox Cluster from the mongo Shell" because I am not able to connect to Atlas … Can someone please give me helping hand.

Your first command tried at shell is failing with authentication error
Looks like you gave wrong password
When i changed password and tried gave this error

mongo “mongodb+srv://cluster0-vx0v3.mongodb.net/test” authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v4.0.5
connecting to: mongodb://cluster0-shard-00-00-vx0v3.mongodb.net.:27017,cluster0-shard-00-01-vx0v3.mongodb.net.:27017,cluster0-shard-00-02-vx0v3.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
Implicit session: session { “id” : UUID(“a0002eee-d0ff-4f86-bcf9-f68e6639f604”) }
MongoDB server version: 4.0.12
loading file: authenticationDatabase
2019-08-16T08:34:56.697+0530 E - [main] file [authenticationDatabase] doesn’t exist
failed to load: authenticationDatabase
Please check you completed all steps and choosen correct version of string
Sandbox cluster and Class cluster are different
Are you able to connect to Class cluster or it is failing for both?

Hi @Vipin_Garg_91754,

As I can see in the error message, you are not able to authenticate yourself with the passed credentials. Please make sure you are using correct username and password in the connection string.

Alternatively, you can also add a new user and use the credentials of the new user to access the cluster.

For creating a new user, please follow the instructions mentioned below :

Login to you atlas cluster acount

Click on Database Access

Click on ADD NEW USER

Create the new user with the same privileges.

If you still have any issue, feel free to get back to us. Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer

1 Like

Ramachandra,
It seem I got lost somewhere . I did completed all step before this. I am trying to connect it with Windows.
Could you please check and let me know what is missing and where did it go wrong for me.
And give me a command to connect Database to shell as required by this chapter ?

Thanks
Vipin

I am able to connect to your sandbox without using authentication param

mongo “mongodb+srv://cluster0-vx0v3.mongodb.net/test” --username m001-student --password m001-mongodb-basics
MongoDB shell version v4.0.5
connecting to: mongodb://cluster0-shard-00-00-vx0v3.mongodb.net.:27017,cluster0-shard-00-01-vx0v3.mongodb.net.:27017,cluster0-shard-00-02-vx0v3.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db
test
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
admin 0.000GB
local 1.577GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY> exit
bye

To connect to Class cluster use this.It will connect to video DB

mongo mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/video?replicaSet=Cluster0-shard-0 --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
To connect other DB’s just replace video with the DB name you wish to use like test,admin etc

1 Like

Did you find the solution?

Hi @Bilal_94547,

Please elaborate the issue that you are having so that I can help you better in resolving your query.

Thanks,
Sonali

I’m not facing any issues I’m asking him so I can help him with the issue.