MongoDB Atlas - Compass - Shell

Hi, I’m new here. I’m a student and I have MongoDB Atlas and MongoDB for VS Code installed on a mac. I’m having difficulty installing Compass and Shell. My instructor doesn’t have instructions for mac users. I’ve looked at several tutorials and gotten more confused.

I’m using the username and password that I use for Atlas and to connect in VS Code. In VS Code I am "currently connected to mongodb+srv://username/password@sandbox.vd7qxrw.mongodb.net. I can see “MongoDB Playground” but have been unable to use it.

When I try and install Compass I get error message “bad auth:authentication failed”.

Any help is appreciated. Thank you!

This is so confusing as I can see the databases/collection in Atlas.

Hi @Jylian_Summers,

This error generally indicates incorrect credentials being entered. You can try troubleshooting it by creating another test database user with no special characters in the password (only for troubleshooting purposes) to see if you’re able to log in via compass with those new credentials. More information on the Configure Database Users documentation which includes adding and modifying database users.

Regards,
Jason

Thank you. My password doesn’t have any special characters. I was going to uninstall but it seems I wouldn’t be able to create a new account for a few days and I’m currently taking a course that requires MongoDB.

1 Like

I’m a bit confused regarding the above. Are you referring to a MongoDB Atlas user account? Or a Database User?

I’ll add that the bad auth error being returned from compass relates to the database user’s credentials.

Look forward to hearing from you.

Regards,
Jason

1 Like

I’m referring to MongoDB Atlas. Ugh, this is so confusing.

Gotcha :slight_smile:

You won’t need to create a new Atlas account or change the Atlas account’s password. What I was suggesting to test is:

  1. Log into Atlas (In most cases, this is with email and password)
  2. Navigate to the Database Deployment section for the cluster you’re trying to connect to with Compass.
  3. On the left hand side, you should see something similar to the following example:
  4. You can then click the red highlighted Database Access tab and re-configure Database User from here.

However, I’m not sure of the exact details of the course you’re following. It could be a case where the course has a pre-created cluster with database user credentials they provide to connect to said cluster. If it’s a cluster provided by the course then please let me know with any further information regarding the course.

Regards,
Jason

Yes, I’ve done that. It is a pre-created cluster, that I’ve been trying to use my credentials to connect to Compass.

Thank you for your help and patience Jason.

Is this cluster under the course creator’s Atlas account or your own Atlas account?

If it’s your own cluster and you’re using the same credentials, i would then double check the connection string is correct. From the image in step 3. in my above response, you’ll also see a “Connect” button to the cluster if it’s your own cluster. You can then follow the connect modal and grab the connection string to be used in MongoDB Compass.

Regards,
Jason

It’s from our instructor’s created course cluster “sandbox”.

Do you have access to the Database Deployment for this “sandbox” cluster? I.e. can you see it when logged in the Atlas Web UI? If you can provide any screenshots, that would be helpful too (redact any personal or sensitive information before posting here).

The

username/password

with a slash in

is wrong.

It has to be

username:password
2 Likes

I tried that. And it doesn’t work. I am logged in to VS code with mongodb+srv://username/password@sandbox.vd7qxrw.mongodb.net

The slash is wrong in

1 Like

When I’m logged in, I see my name in the upper right corner and when I click on Database this screen is returned. When I click “Browse Collections” I can see the ones for my class.

mongodb+srv://username:@sandbox.vd7qxrw.mongodb.net/ connected

2 Likes

Great catch Steve. Missed my eye :person_facepalming:

1 Like

VS Code shows:
username/password@sandbox.vd7qxrw.mongodb.net/ connected

Compass is generating error

Username contains unescaped characters username/password

so I have a hard time believing that VS is showing you are connected. But if you are connected then the issue is resolved.

I’m trying to install Compass. Don’t I need to do that in addition to VS Code?

One is not required for the other. I assume the course is trying to get you to do something in VS code and perhaps another in Compass but it’s hard to say without knowing the course / it’s content though this is probably moving away from the original issue. I believe once you’re able to connect to both then you can proceed with it’s content so we’ll focus on that.

The original issue from what was raised in the post itself was the error regarding bad auth in compass – Can you confirm you were able to connect via compass or you’re still getting bad auth error from compass?

1 Like