Failing to connect to Sandbox cluster

I get the following when I try and connect anyone any ideas, have checked everything
C:\Users\knowlesrd>mongo “mongodb://cluster0-shard-00-00-qgbj4.mongodb.net:27017,cluster0-shard-00-01-qgbj4.mongodb.net:27017,cluster0-shard-00-02-qgbj4.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.9
connecting to: mongodb://cluster0-shard-00-00-qgbj4.mongodb.net:27017,cluster0-shard-00-01-qgbj4.mongodb.net:27017,cluster0-shard-00-02-qgbj4.mongodb.net:27017/test?replicaSet=Cluster0-shard-0
2019-01-19T16:29:57.964+0000 I NETWORK [thread1] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-qgbj4.mongodb.net:27017,cluster0-shard-00-01-qgbj4.mongodb.net:27017,cluster0-shard-00-02-qgbj4.mongodb.net:27017
2019-01-19T16:29:58.147+0000 I NETWORK [thread1] Successfully connected to cluster0-shard-00-01-qgbj4.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01-qgbj4.mongodb.net:27017 with a 5 second timeout)
2019-01-19T16:29:58.148+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to cluster0-shard-00-00-qgbj4.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-qgbj4.mongodb.net:27017 with a 5 second timeout)
2019-01-19T16:29:58.375+0000 I NETWORK [thread1] Successfully connected to cluster0-shard-00-02-qgbj4.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02-qgbj4.mongodb.net:27017 with a 5 second timeout)
Implicit session: session { “id” : UUID(“d377146c-3262-4f5f-a2c1-359ed959edba”) }
MongoDB server version: 4.0.5
WARNING: shell and server versions do not match
2019-01-19T16:29:58.804+0000 I NETWORK [thread1] Marking host cluster0-shard-00-00-qgbj4.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-00-qgbj4.mongodb.net:27017: bad auth Authentication failed.
2019-01-19T16:29:58.959+0000 I NETWORK [thread1] Successfully connected to cluster0-shard-00-01-qgbj4.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01-qgbj4.mongodb.net:27017 with a 0 second timeout)
2019-01-19T16:29:59.072+0000 I NETWORK [thread1] Marking host cluster0-shard-00-01-qgbj4.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-01-qgbj4.mongodb.net:27017: bad auth Authentication failed.
2019-01-19T16:29:59.189+0000 I NETWORK [thread1] Successfully connected to cluster0-shard-00-02-qgbj4.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02-qgbj4.mongodb.net:27017 with a 0 second timeout)
2019-01-19T16:29:59.283+0000 I NETWORK [thread1] Marking host cluster0-shard-00-02-qgbj4.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-02-qgbj4.mongodb.net:27017: bad auth Authentication failed.
2019-01-19T16:29:59.375+0000 I NETWORK [thread1] Marking host cluster0-shard-00-00-qgbj4.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node cluster0-shard-00-00-qgbj4.mongodb.net:27017: bad auth Authentication failed.
2019-01-19T16:29:59.375+0000 E QUERY [thread1] Error: can’t authenticate against replica set node cluster0-shard-00-00-qgbj4.mongodb.net:27017: bad auth Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1608:20
@(auth):6:1
@(auth):1:2
exception: login failed

I am able to connect successfully with the command you pasted.No issues
Please check again.While cut & paste commands if some invalid/junk characters are introduced your login fails
For example when basics is typed as basicss
you will get connection failed

When userid/pwd jumps to second line you will get auth. failure as below
vagrant@m103:/dataset$ mongo --host “m103-example/192.168.103.100:27011” -u “m103-admin”
103-pass" --authenMongoDB shell version v3.6.9
ticationDatabase "admin"connecting to: mongodb://192.168.103.100:27011/?replicaSet=m103-example

@(auth):1:2
exception: login failed
vagrant@m103:/dataset$ -p “m103-pass” --authenticationDatabase “admin”
-p: command not found
vagrant@m103:/dataset$

So copy the command in a notepad and paste properly.You should be able to login
Output from my terminal with the command you used:
vagrant@m103:/dataset$ mongo mongodb://cluster0-shard-00-00-qgbj4.mongodb.net:27017,cluster0-shard-00-01-qgbj4.mongodb.net:27017,cluster0-shard-00-02-qgbj4.mongodb.net:27017/test?replicaSet=Cluster0-shard-0 --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.9
MongoDB server version: 4.0.5
WARNING: shell and server versions do not match
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db
test
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use admin
switched to db admin
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
admin 0.000GB
local 2.816GB
video 0.001GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

Yes I tried later and also seemed to work, not sure what the original issue was?

Hi @Ramachandra_37567,
I am also facing the same problem as below.

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

2019-06-22T22:10:28.416+0530 E QUERY [js] Error: can’t authenticate against replica set node cluster007-shard-00-00-8dhvb.mongodb.net:27017 :: caused by :: can’t connect to new replica set master [cluster007-shard-00-00-8dhvb.mongodb.net:27017], err: Location8000: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
I have already whitelisted 0.0.0.0/0 ip here and entering the right password. Also my password contains special characters so I considered https://docs.atlas.mongodb.com/troubleshoot-connection/#special-characters-in-connection-string-password this as well.
But I am able to connect through compass, the only problem is through the shell connection is not possible.
@Russell_92217

Can you paste the command you used?
Did you include password option in the command.Did it ask for password?

Can’t connect to sandbox cluster!

1 Like

Hey @Abhilash_25338,

Are you able to connect to the cluster now?

I hope the solution posted by @Ramachandra_37567 helped.

If you still have any problem, please check your password and make sure you do not copy/paste it. Also, share your complete connection string.

Thanks,
Sonali

sent July 4 2019
I am also having trouble connecting to the sandbox. When I click on connect I don’t receive the same string in the video. I have the following string instead:

mongo “mongodb+srv://della-m001-fsgmr.mongodb.net/test” --username m001-student

then I added password at the end the way he instructed. Please help, thanks!

Hi @Della_90614,

The connection string for Atlas Sandbox cluster is different for everyone, as the cluster is created by all users individually.

You can connect to your cluster using the following connection string:

mongo mongodb+srv://della-m001-fsgmr.mongodb.net/test --username m001-student --password m001-mongodb-basics

Please let me know, if you have any questions.

Thanks,
Sonali

Hurray I think that worked!!

Thank you!

I had to create a new account because I selected Enterprise and could not go back and select free . And I also had problems connecting the sandbox to my cluster so I copy the new string:

mongo “mongodb+srv://cluster0-eqlxn.mongodb.net/test” --username m001-student

into my shell and get the following error:

[js] Error: can’t authenticate against replica set node cluster0-shard-00-00-eqlxn.mongodb.net:27017 :: caused by :: can’t connect to new replica set master [cluster0-shard-00-00-eqlxn.mongodb.net:27017], err: Location8000: bad auth Authentication failed. :

connect@src/mongo/shell/mongo.js:344:17

@(connect):2:6

exception: connect failed

Any help is welcomed, thank you,

It says bad auth authentication failed
Did you give correct password?
Make sure no spaces in pwd while cut & paste