Exception: login failed

mongo “mongodb+srv://sandbox-qmaqa.mongodb.net/test” --username m220student
MongoDB shell version v4.0.2
Enter password:
connecting to: mongodb+srv://sandbox-qmaqa.mongodb.net/test

2019-09-21T22:15:55.177+0530 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-02-qmaqa.mongodb.net.:27017,sandbox-shard-00-01-qmaqa.mongodb.net.:27017,sandbox-shard-00-00-qmaqa.mongodb.net.:27017

2019-09-21T22:15:56.069+0530 I NETWORK [js] Successfully connected to sandbox-shard-00-00-qmaqa.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-00-qmaqa.mongodb.net.:27017 with a 5 second timeout)

2019-09-21T22:15:56.081+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-02-qmaqa.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-02-qmaqa.mongodb.net.:27017 with a 5 second timeout)

2019-09-21T22:15:56.297+0530 I NETWORK [js] changing hosts to Sandbox-shard-0/sandbox-shard-00-00-qmaqa.mongodb.net:27017,sandbox-shard-00-01-qmaqa.mongodb.net:27017,sandbox-shard-00-02-qmaqa.mongodb.net:27017 from Sandbox-shard-0/sandbox-shard-00-00-qmaqa.mongodb.net.:27017,sandbox-shard-00-01-qmaqa.mongodb.net.:27017,sandbox-shard-00-02-qmaqa.mongodb.net.:27017

2019-09-21T22:15:57.186+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-02-qmaqa.mongodb.net:27017 (1 connections now open to sandbox-shard-00-02-qmaqa.mongodb.net:27017 with a 5 second timeout)

2019-09-21T22:15:57.248+0530 I NETWORK [js] Successfully connected to sandbox-shard-00-01-qmaqa.mongodb.net:27017 (1 connections now open to sandbox-shard-00-01-qmaqa.mongodb.net:27017 with a 5 second timeout)

2019-09-21T22:15:58.337+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-00-qmaqa.mongodb.net:27017 (1 connections now open to sandbox-shard-00-00-qmaqa.mongodb.net:27017 with a 5 second timeout)

MongoDB server version: 4.0.12

2019-09-21T22:16:00.569+0530 I NETWORK [js] Marking host sandbox-shard-00-00-qmaqa.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node sandbox-shard-00-00-qmaqa.mongodb.net:27017 :: caused by :: bad auth Authentication failed.

2019-09-21T22:16:01.036+0530 I NETWORK [js] Marking host sandbox-shard-00-02-qmaqa.mongodb.net:27017 as failed :: caused by :: SocketException: can’t authenticate against replica set node sandbox-shard-00-02-qmaqa.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [sandbox-shard-00-02-qmaqa.mongodb.net:27017] connection pool error: network error while attempting to run command ‘isMaster’ on host ‘sandbox-shard-00-02-qmaqa.mongodb.net:27017

2019-09-21T22:16:01.662+0530 I NETWORK [js] Marking host sandbox-shard-00-01-qmaqa.mongodb.net:27017 as failed :: caused by :: SocketException: can’t authenticate against replica set node sandbox-shard-00-01-qmaqa.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [sandbox-shard-00-01-qmaqa.mongodb.net:27017] connection pool error: network error while attempting to run command ‘isMaster’ on host ‘sandbox-shard-00-01-qmaqa.mongodb.net:27017

2019-09-21T22:16:02.528+0530 I NETWORK [js] Marking host sandbox-shard-00-00-qmaqa.mongodb.net:27017 as failed :: caused by :: Location8000: can’t authenticate against replica set node sandbox-shard-00-00-qmaqa.mongodb.net:27017 :: caused by :: bad auth Authentication failed.

2019-09-21T22:16:02.528+0530 E QUERY [js] Error: can’t authenticate against replica set node sandbox-shard-00-00-qmaqa.mongodb.net:27017 :: caused by :: bad auth Authentication failed. :

DB.prototype._authOrThrow@src/mongo/shell/db.js:1685:20

@(auth):6:1

@(auth):1:2

exception: login failed

Bad authentication means wrong id/pwd used?
What is the user you created in your Sandbox?
Please try with correct userid/pwd.It should work
I don’t think m220student is correct user

Hi @Rasika_53250,

I hope your issue got resolved. However, if that is not the case then please feel free to reach out to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer