Chapter 1 connecting to shell issue

I have everything set up correctly, I had to completely delete all my old info and clusters to get this setup for the shell, and yet I can’t get access. Is there a particular database I need to use? My connection string has myFirstDatabase but I’ve also tried sandbox and a created database named m001. My username, password and allowed IP are all correct. Just keeps failing both request.

Hi @Tony_Abele,

Kindly share the screenshot of the IDE with the error msg, so we can filter out the exact reason behind your issue.

Thanks,
Kushagra

I’ve also tested locally on mongoshell and have access using same info, and yes I have allowed ip 0.0.0.0/0.

1 Like

Hi @Tony_Abele,

Kindly share the screenshot of the IDE with the error msg and the command you used to connect to the Atlas cluster, so we can filter out the exact reason behind your issue.

And, we can see there is no issue within your local shell accessing the cloud cluster.
But you have to use IDE to connect to the cluster in order to pass the lab within the course.

All the Best,
Kushagra

I don’t know if this is helpful…I of course know what is required to pass this part, which is why I am frustrated with such a simple task(that i have done many times before) And it was as I feared I needed to change database to admin. You guys should really update the lab page with that info, or even post the link to this FAQ on the lab itself. Would have saved me a lot of time that I have wasted.

Hi @Tony_Abele,

We at MongoDB University, always strive to make the learning experience super fun and challenging but not frustrating. So, we apologise for the inconveniences caused to you.

Meanwhile, thank you for your suggestion, we will surely look into this.

For now, there is no any specific database to connect within the IDE to pass that lab, just connection to the cloud cluster need to be authenticated and connected. And, similarly to the second task username should be m001-student.

Kindly cross check again. We really appreciate your patience on this.

All the Best,
Kushagra

Yes the following is very useful.

Because we can see what you typed. We can see the error you got.

You need to close this because I already fixed this issue, no thanks to you or whoever the hell Steeve is! The lab needs to say change /myFirstDatabase to admin for the IDE shell to work. Which was my exact question in the first post…bye.

Hi @Tony_Abele,

We understand your frustration here, but we don’t want to misinform any learners out there.

So, FYI: I passed the same lab using the myFirstDatabase db, which I earlier mentioned that db name doesn’t matter for this lab.

user@M001# mongo "mongodb+srv://sandbox.hdrnf.mongodb.net/myFirstDatabase" --username m001-student
MongoDB shell version v4.0.5
Enter password: 
connecting to: mongodb://sandbox-shard-00-01.hdrnf.mongodb.net.:27017,sandbox-shard-00-02.hdrnf.mongodb.net.:27017,sandbox-shard-00-00.hdrnf.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-5dyod8-shard-0&ssl=true
2021-06-04T08:11:29.856+0000 I NETWORK  [js] Starting new replica set monitor for atlas-5dyod8-shard-0/sandbox-shard-00-01.hdrnf.mongodb.net.:27017,sandbox-shard-00-02.hdrnf.mongodb.net.:27017,sandbox-shard-00-00.hdrnf.mongodb.net.:27017
2021-06-04T08:11:29.907+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-02.hdrnf.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-02.hdrnf.mongodb.net.:27017 with a 5 second timeout)
2021-06-04T08:11:29.907+0000 I NETWORK  [js] Successfully connected to sandbox-shard-00-01.hdrnf.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-01.hdrnf.mongodb.net.:27017 with a 5 second timeout)
2021-06-04T08:11:29.908+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] changing hosts to atlas-5dyod8-shard-0/sandbox-shard-00-00.hdrnf.mongodb.net:27017,sandbox-shard-00-01.hdrnf.mongodb.net:27017,sandbox-shard-00-02.hdrnf.mongodb.net:27017 from atlas-5dyod8-shard-0/sandbox-shard-00-00.hdrnf.mongodb.net.:27017,sandbox-shard-00-01.hdrnf.mongodb.net.:27017,sandbox-shard-00-02.hdrnf.mongodb.net.:27017
2021-06-04T08:11:29.922+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-02.hdrnf.mongodb.net:27017 (1 connections now open to sandbox-shard-00-02.hdrnf.mongodb.net:27017 with a 5 second timeout)
2021-06-04T08:11:29.925+0000 I NETWORK  [js] Successfully connected to sandbox-shard-00-01.hdrnf.mongodb.net:27017 (1 connections now open to sandbox-shard-00-01.hdrnf.mongodb.net:27017 with a 5 second timeout)
2021-06-04T08:11:29.963+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-00.hdrnf.mongodb.net:27017 (1 connections now open to sandbox-shard-00-00.hdrnf.mongodb.net:27017 with a 5 second timeout)
Implicit session: session { "id" : UUID("2f8172e3-a3ee-4299-8a49-ec49b24b1504") }
MongoDB server version: 4.4.6
WARNING: shell and server versions do not match
MongoDB Enterprise atlas-5dyod8-shard-0:PRIMARY> show dbs
admin               0.000GB
local               3.196GB
m001                0.000GB
sample_airbnb       0.051GB
sample_analytics    0.009GB
sample_geospatial   0.001GB
sample_mflix        0.041GB
sample_restaurants  0.006GB
sample_supplies     0.001GB
sample_training     0.046GB
sample_weatherdata  0.003GB
test                0.000GB
MongoDB Enterprise atlas-5dyod8-shard-0:PRIMARY>` 

NOW,

After hitting Run Test Button, I got confirmed that I have successfully passed both the task of this lab. :sparkles:

We wish you good luck with the rest of the course.
Kindly feel free to reach out in case of any queries or doubts.

Thanks,
Kushagra

Hello,
I think we are supposed to comment on this thread, if we need help with connecting to the database, in chapter 1, via the IDE.

I’m not able to connect to the db.

I’m not sure which parts of the db url are safe to paste here. My database URL does not have the word “sandbox” in it. I can see a button that says “sandbox” in the summary of the db; but it doesn’t show up.

I’m pasting:

mongo “mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase” --username m001-student

Then, for the password: m001-mongodb-basics

The username on my account also says. m001-student@admin. So, I’ve tried using that as the username, and it does not work either.

The IDE currently looks like this, after I try to reset it, and log out and log back in, etc:

After I paste and run the connection string, it says this:

user@M001# mongo “mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase” -username m001-student
MongoDB shell version v4.0.5
exception: No digits
user@M001# 

Can anyone tell me how I can fix this, and connect to the db?

Also, do I need to change my database url/ delete and remake one, now that I posted the url?

Thanks for any help!

Hi @Mjob,

Welcome to the MongoDB community Forums,

I think there is issue with the double quotes in your connection string.
So, first reset your workspace and then paste the following connection string

mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student

Make sure you use the parallel double quotes " " to bind your string. And then enter your password (the blinking cursor will be not visible, so don't worry).
It will work as expected.

In case of any further issue, feel free to reach out to us.!!

Happy Learning :slightly_smiling_face:

Thanks,
Kushagra

Thanks @ Kushagra_Kesav, That got me a little further along, but I’m still not able to get it to work.

This is what it is doing now:

When I do a regular login attempt (without adding @admin to the username):

> user@M001# mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student
> MongoDB shell version v4.0.5
> Enter password: 
> connecting to: mongodb://cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
> 2021-07-22T15:02:31.656+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017
> 2021-07-22T15:02:31.703+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:02:31.704+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:02:31.710+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-22T15:02:31.726+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:02:31.728+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:02:31.773+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:02:31.810+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-02.lwgfd.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
> 2021-07-22T15:02:31.812+0000 I NETWORK  [js] Marking host cluster0-shard-00-00.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-00.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-00.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-00.lwgfd.mongodb.net:27017' 
> 2021-07-22T15:02:31.815+0000 I NETWORK  [js] Marking host cluster0-shard-00-01.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-01.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-01.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-01.lwgfd.mongodb.net:27017' 
> 2021-07-22T15:02:31.839+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.m
> user@M001# mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student
> MongoDB shell version v4.0.5
> Enter password: 
> connecting to: mongodb://cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
> 2021-07-22T15:04:23.575+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017
> 2021-07-22T15:04:23.625+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:04:23.626+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:04:23.626+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-22T15:04:23.641+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:04:23.643+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:04:23.682+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
> Implicit session: session { "id" : UUID("9b1501b3-10c4-47c1-8c9c-47667c83002b") }
> MongoDB server version: 4.4.6
> WARNING: shell and server versions do not match
> Welcome to the MongoDB shell.
> For interactive help, type "help".
> For more comprehensive documentation, see
>         http://docs.mongodb.org/
> Questions? Try the support group
>         http://groups.google.com/group/mongodb-user
> user@M001# mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student@admin
> MongoDB shell version v4.0.5
> Enter password: 
> connecting to: mongodb://cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
> 2021-07-22T15:06:13.887+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017
> 2021-07-22T15:06:13.946+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:06:13.946+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:06:13.965+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:06:13.965+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:06:13.966+0000 I NETWORK  [js] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-22T15:06:13.980+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:06:13.982+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:06:14.022+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-02.lwgfd.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
> 2021-07-22T15:06:14.023+0000 I NETWORK  [js] Marking host cluster0-shard-00-00.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-00.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-00.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-00.lwgfd.mongodb.net:27017' 
> 2021-07-22T15:06:14.026+0000 I NETWORK  [js] Marking host cluster0-shard-00-01.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-01.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-01.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-01.lwgfd.mongodb.net:27017' 
> 2021-07-22T15:06:14.042+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.m
> user@M001# mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student
> MongoDB shell version v4.0.5
> Enter password: 
> connecting to: mongodb://cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
> 2021-07-22T15:11:07.400+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-22T15:11:07.450+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:11:07.450+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:11:07.473+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-22T15:11:07.474+0000 I NETWORK  [js] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-22T15:11:07.476+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:11:07.490+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-22T15:11:07.491+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
> Implicit session: session { "id" : UUID("8b156463-401c-45f6-a1e5-a2e37a2f2747") }
> MongoDB server version: 4.4.6
> 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 atlas-eu20cv-shard-0:PRIMARY>

… AND

When I try adding the @admin to the end of the username:

MongoDB shell version v4.0.5
Enter password: 
connecting to: mongodb://cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
2021-07-22T15:06:13.887+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017
2021-07-22T15:06:13.946+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net.:27017 with a 5 second timeout)
2021-07-22T15:06:13.946+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
2021-07-22T15:06:13.965+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
2021-07-22T15:06:13.965+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
2021-07-22T15:06:13.966+0000 I NETWORK  [js] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
2021-07-22T15:06:13.980+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
2021-07-22T15:06:13.982+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
2021-07-22T15:06:14.022+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-02.lwgfd.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
2021-07-22T15:06:14.023+0000 I NETWORK  [js] Marking host cluster0-shard-00-00.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-00.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-00.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-00.lwgfd.mongodb.net:27017' 
2021-07-22T15:06:14.026+0000 I NETWORK  [js] Marking host cluster0-shard-00-01.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-01.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-01.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-01.lwgfd.mongodb.net:27017' 
2021-07-22T15:06:14.042+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-02.lwgfd.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
2021-07-22T15:06:14.043+0000 E QUERY    [js] Error: can't authenticate against replica set node cluster0-shard-00-02.lwgfd.mongodb.net:27017 :: caused by :: can't connect to new replica set master [cluster0-shard-00-02.lwgfd.mongodb.net:27017], err: Location8000: bad auth : Authentication failed. :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

Also:
Do I need to change my db url now that I’ve posted it?

Thanks again for the help!

Hi @Mjob,

I think you are entering the wrong password. Kindly use the correct one which is m001-mongodb-basics
It will work as expected.

Thank you,
Kushagra

You are already at mongo prompt which means you made successful connection to your cluster
May be you are confused with user cannot perform action against admin
Where it is given that you should add @admin to your user?
That is the reason why your connection failing with bad authentication (wrong combination of user id/pwd)
Try the connect string given by Kushagra_Kesav.It will work

Hi guys,
Sorry for the delayed reply. I am still getting errors.
It says that the shell version and server version do not match.

> user@M001# mongo "mongodb+srv://cluster0.lwgfd.mongodb.net/myFirstDatabase" --username m001-student
> MongoDB shell version v4.0.5
> Enter password: 
> connecting to: mongodb://cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017/myFirstDatabase?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-eu20cv-shard-0&ssl=true
> 2021-07-26T00:58:30.510+0000 I NETWORK  [js] Starting new replica set monitor for atlas-eu20cv-shard-0/cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017,cluster0-shard-00-00.lwgfd.mongodb.net.:27017
> 2021-07-26T00:58:30.570+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-26T00:58:30.570+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net.:27017 with a 5 second timeout)
> 2021-07-26T00:58:30.572+0000 I NETWORK  [js] changing hosts to atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net:27017,cluster0-shard-00-01.lwgfd.mongodb.net:27017,cluster0-shard-00-02.lwgfd.mongodb.net:27017 from atlas-eu20cv-shard-0/cluster0-shard-00-00.lwgfd.mongodb.net.:27017,cluster0-shard-00-01.lwgfd.mongodb.net.:27017,cluster0-shard-00-02.lwgfd.mongodb.net.:27017
> 2021-07-26T00:58:30.587+0000 I NETWORK  [js] Successfully connected to cluster0-shard-00-02.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-26T00:58:30.588+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01.lwgfd.mongodb.net:27017 with a 5 second timeout)
> 2021-07-26T00:58:30.623+0000 I NETWORK  [js] Marking host cluster0-shard-00-02.lwgfd.mongodb.net:27017 as failed :: caused by :: SocketException: can't authenticate against replica set node cluster0-shard-00-02.lwgfd.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [cluster0-shard-00-02.lwgfd.mongodb.net:27017] connection pool error: network error while attempting to run command 'isMaster' on host 'cluster0-shard-00-02.lwgfd.mongodb.net:27017' 
> 2021-07-26T00:58:30.628+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00.lwgfd.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00.lwgfd.mongodb.net:27017 with a 5 second timeout)
> Implicit session: session { "id" : UUID("97503b8d-1223-4cdf-863e-dd972b2d2d41") }
> MongoDB server version: 4.4.7
> WARNING: shell and server versions do not match
> Welcome to the MongoDB shell.
> For interactive help, type "help".
> For more comprehensive documentation, see
>         http://docs.mongodb.org/
> Questions? Try the support group
>         http://groups.google.com/group/mongodb-user
> Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
> MongoDB Enterprise atlas-eu20cv-shard-0:PRIMARY> help
>         db.help()                    help on db methods
>         db.mycoll.help()             help on collection methods
>         sh.help()                    sharding helpers
>         rs.help()                    replica set helpers
>         help admin                   administrative help
>         help connect                 connecting to a db help
>         help keys                    key shortcuts
>         help misc                    misc things to know
>         help mr                      mapreduce
> 
>         show dbs                     show database names
>         show collections             show collections in current database
>         show users                   show users in current database
>         show profile                 show most recent system.profile entries with time >= 1ms
>         show logs                    show the accessible logger names
>         show log [name]              prints out the last segment of log in memory, 'global' is default
>         use <db_name>                set current database
>         db.foo.find()                list objects in collection foo
>         db.foo.find( { a : 1 } )     list objects in foo where a == 1
>         it                           result of the last line evaluated; use to further iterate
>         DBQuery.shellBatchSize = x   set default number of items to display on shell
>         exit                         quit the mongo shell
> MongoDB Enterprise atlas-eu20cv-shard-0:PRIMARY>

It did not say that. The username had @admin at the end of it in the database, so was just trying all of the possible options.

Somehow it worked. Not sure how. I did not change anything, but it started working.

It was working before too
You can ignore “shell version and server version do not match” warning messages

1 Like

Hi @Mjob,

We are happy that your issue is finally resolved.
As @Ramachandra_Tummala mentioned ignore that version mismatch warning.

All the Best with the rest of the course.

Thanks,
Kushagra