Connecting to Atlas cluster using Compass on MacOS

I created Atlas cluster as per Chapter 2, but I am not able to connect to the cluster using Compass running on my iMac (macOS High Sierra). I followed the instructions and copied the connection string: mongodb+srv://:@cluster0-acib9.mongodb.net/test into Compass, but I am getting a connection error: “queryTxt EBADNAME cluster0-acib9.mongodb.net

I can connect to course the cluster: cluster0-shard-00-00-jxeqq.mongodb.net using the same Compass client, but not to the Atlas cluster free tier cluster I created: cluster0-acib9.mongodb.net/test.

I hope someone can assist to resolve this issue so that I can continue with the course.

I can connect to your Sandbox from shell
The string you got is for command line not compass
You have to fill all the fields in compass like host,port etc of your Sandbox
Please check our forums
Screenshots available

Hi Ramachandra,
thank your for your response. The connection string I am using is generated by “Copy the connection string below, and open Compass:”

Where do I find the complete connection string?

regards

George

Ok got what you are saying
Please check this link

Steps to Connect to Atlas Cluster

So after you copy the link and open compass it auto populates
I think you just need to choose a password

What i mentioned in my reply was to login by another method
Since you know your Sandbox hostname just open compass GUI and fill all the fields like hostname,port etc and save the details under favourites and login

Hi
I appreciate you taking time with this. Unfortunately the procedure you describe using auto populate does not work (I tried many variations), It populates the Compass login screen with the values below:

Hostname: cluster0-acib9.mongodb.net

SRV Record: On

Authentication: Username/Password

Authentication Database: admin

Replica Set Name:

Read Preference: Primary

SSL: System CA /Atlas Deployment

SSH Tunnel: None

Favorite Name:

When try to connect I get a cryptic message in red on the top of the screen: “queryTxt EBADNAME cluster0-acib9.mongodb.net"

The hostname may not be complete, I noticed that the M001 RS login has -shard-00-00- as part of the hostname. Also the Replica Set Name is not specified.

How do I find the correct values for all the fields in Compass login screen?

regards,

George

I am able to connect to your cluster thru Compass
Use Replica Set Name Cluster0

Hi
I still cannot connect using the same values as you. I am using Compass Version 1.19.12 (1.19.12) for MacOS Version 11.5 (3445.9.1). Is this the correct version?

regards,

George

So this is your own private Atlas account and Cluster right?

You need to allow access to your Cluster via the Network Access menu:


On this page, on the far right, click on Add IP Address then select whether you want to Add Current IP Address or Allow Access from Anywhere. Suggest the former.

Hi
now that I managed to connect using Compass, Lecture 2 requires connection using Mongo shell. My Compass connection screen is as follows:

Hostname: cluster0-shard-00-00-acib9.mongodb.net
SRV Record:
Authentication: Username/Password
Authentication Database: admin

Username: m001-student
Replica Set Name: Cluster0-shard-0
Read Preference: Primary
SSL: System CA /Atlas Deployment
SSH Tunnel: None
Favorite Name:

What is the corresponding shell command? Can you point me to where is this documented.

regards,

George

Hi @George_89197,

Please refer this post for the steps to getting the connection string of your sandbox cluster.

Hope it helps!

If you have any other issue, please feel free to get back to us.

Happy Leanring :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Hi Shubham
thanks for your response. Unfortunately, we are going round circles. The post you are pointing to shows the standard method of copying the string from Atlas - this generates an incorrect connection string! I am using MacOS, it may work on Windows, on MacOS it produces an incomplete connection string.

I had assistance earlier for the Compass connection:

Hostname: cluster0-shard-00-00-acib9.mongodb.net
SRV Record:
Authentication: Username/Password
Authentication Database: admin
Username: m001-student
Replica Set Name: Cluster0-shard-0
Read Preference: Primary
SSL: System CA /Atlas Deployment
SSH Tunnel: None
Favorite Name:

But Lecture 2 requires a Mongo shell connection to Atlas Sandbox I created. I have a very simple question: Given the Compass connection parameters above, what is the Mongo shell connection string?

I have already spent hours trying to resolve the connection problems; I can see that other people have similar connection issues. Please, do not refer me to posts and online documentation that invariably ends up in the same place: https://cloud.mongodb.com/v2/5d92c947d5ec139d1a8f5281#clusters/connect?clusterId=Cluster0

Unfortunately, this method does NOT work!

regards,

George

Hi @George_89197,

It does not matter what platform you are using, it should have the same connection string for your mongo shell.

Yes Geroge, I am aware of it :slight_smile:

If you insist then here is your connection string that I have compiled for you but this is not the right way to get it.

mongo "mongodb+srv://cluster0-acib9.mongodb.net/test"  -u m001-student -p m001-mongodb-basics

As I can see, you have created two users for your cluster and that’s why the username is not being auto-filled. If you delete one of them which you do not need then it will fix the issue for you. However, you can very easily append the username and password at the end of the string using the -u and -p parameters.

Hope it helps!

If you have any other issue please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer