Getting error while connecting to Sandbox

Getting below error while connecting to Sandbox. I changed preferences also but it didn’t help.

An error occurred while loading navigation: ‘not master and slaveOk=false’: It is recommended to change your read preference in the connection dialog to Primary Preferred or Secondary Preferred or provide a replica set name for a full topology connection.

Were you able to connect to your Sandbox before with compass? or connecting for the first time?
What version of compass are you using
May be firewall preventing connection
Please check your connection parameters and try to switch off SRV and other options as suggested in our forum
Are you able to connect by shell?

Hi @Harish_35149,

Can you please make sure you are entering the connection string of the Primary node and also enter the replica set name of your cluster in the Replica Set Name field.

If it does not resolve the issue, then please share the connection string of your cluster and other credentials such as username and password.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

I’m having this same problem - I could connect to Compass up to a few days ago. I can connect to my sandbox through Atlas and commandline. I tried shutting down the cluster through Atlas, that didn’t work.
What finally worked was filling in the ‘replica set name’ for my cluster.
Any idea why that worked?
Also, why it stopped working initially?

Thanks

So it worked without replicaset name before?

From doc

Check Replica Set Name

Check that your Replica Set Name is accurate. Compass is only able to identify the primary correctly if the replica set name is accurate.

https://docs.mongodb.com/compass/master/troubleshooting/connection-errors/

Hi @bethboose,

It might be possible that the primary of your replica set changed and hence the old connection string that you were using in Compass was pointing to a secondary now. Additionally, you can always check the status of any particular node by logging into your Atlas account.

When you mention the name of the replica set on the connection screen, Compass is able to identify the primary correctly and hence you were able to connect.

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer