Can’t connect to Atlas cluster created by using Mongo shell

I can get a connection to my cluster however when I run the show dbs command I get an error, please see below:

PS C:\Users\Administrator> mongo “mongodb+srv://sandbox-ks4fa.mongodb.net/test”
MongoDB shell version v4.2.3
connecting to: mongodb://sandbox-shard-00-00-ks4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox
-shard-00-02-ks4fa.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=San
dbox-shard-0&ssl=true
2020-03-05T09:11:38.347-0500 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-00-k
s4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox-shard-00-02-ks4fa.mongodb.net:27017
2020-03-05T09:11:38.348-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-01-ks4fa.mongod
b.net:27017
2020-03-05T09:11:38.348-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-00-ks4fa.mongod
b.net:27017
2020-03-05T09:11:38.348-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-02-ks4fa.mongod
b.net:27017
2020-03-05T09:11:38.569-0500 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Sandbox-shard-0 is S
andbox-shard-0/sandbox-shard-00-00-ks4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox-shard-00-
02-ks4fa.mongodb.net:27017
Implicit session: session { “id” : UUID(“5835645a-8e47-4b09-bfb8-07dbc52f9bef”) }
MongoDB server version: 4.2.3
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise Sandbox-shard-0:PRIMARY> show dbs
2020-03-05T09:13:49.760-0500 E QUERY [js] uncaught exception: Error: listDatabases failed:{
“ok” : 0,
“errmsg” : “user is not allowed to do action [listDatabases] on [admin.]”,
“code” : 8000,
“codeName” : “AtlasError”
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs/<@src/mongo/shell/mongo.js:135:19
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:87:12
shellHelper.show@src/mongo/shell/utils.js:906:13
shellHelper@src/mongo/shell/utils.js:790:15
@(shellhelp2):1:1
MongoDB Enterprise Sandbox-shard-0:PRIMARY>

If I use the string I copied from the instructions
mongo “mongodb+srv://sandbox-xxxxx.mongodb.net/test” --username m001-student --password m001-student-basics

I get this error

connecting to: mongodb://sandbox-shard-00-00-ks4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox
-shard-00-02-ks4fa.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=San
dbox-shard-0&ssl=true
2020-03-05T09:34:18.209-0500 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-00-k
s4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox-shard-00-02-ks4fa.mongodb.net:27017
2020-03-05T09:34:18.213-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-01-ks4fa.mongod
b.net:27017
2020-03-05T09:34:18.215-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-00-ks4fa.mongod
b.net:27017
2020-03-05T09:34:18.215-0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-02-ks4fa.mongod
b.net:27017
2020-03-05T09:34:18.528-0500 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Sandbox-shard-0 is S
andbox-shard-0/sandbox-shard-00-00-ks4fa.mongodb.net:27017,sandbox-shard-00-01-ks4fa.mongodb.net:27017,sandbox-shard-00-
02-ks4fa.mongodb.net:27017
2020-03-05T09:34:18.818-0500 I NETWORK [js] Marking host sandbox-shard-00-01-ks4fa.mongodb.net:27017 as failed :: caus
ed by :: Location40659: can’t connect to new replica set master [sandbox-shard-00-01-ks4fa.mongodb.net:27017], err: Auth
enticationFailed: bad auth Authentication failed.

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

2020-03-05T09:34:18.820-0500 E QUERY [js] Error: can’t connect to new replica set master [sandbox-shard-00-01-ks4fa.
mongodb.net:27017], err: AuthenticationFailed: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-03-05T09:34:18.827-0500 F - [main] exception: connect failed
2020-03-05T09:34:18.828-0500 E - [main] exiting with code 1
PS C:\Users\Administrator>

I have tried both cmd prompt and powershell with identical results. The instructions in the lab state that I should get prompts for username and password. I could really use a solution as I would really like to continue my courses

It looks like

Verify your password and user name.

I did verify here is a screenshot:

thanks steevej-1495

Am I using the correct syntax?
PS C:\Users\Administrator> mongo “mongodb+srv://sandbox-ks4fa.mongodb.net/test” --username m001-student --password m001-student-basics

The password you set is m001-mongodb-basics and you are trying with m001-student-basics.

So

1 Like

thank you so much for noticing that steevej-1495

I feel stupid I will try to not open too many more tickets and be more thorough in reviewing my issues

Do not feel stupid. That kind of errors are the most frequent. I did not notice first when you posted the snapshot so the comment verify your password goes for me too.

1 Like

Good catch @steevej-1495.

Hi @Andrew_Buchan_21270,

I’m glad your issue got resolved. Please feel free to get back to us if you face any other difficulty.

Thanks,
Shubham Ranjan
Curriculum Services Engineer