Compass Error Message Trying to Connect via Favorites

I’m now in Chapter 3 but am posting here because it has to do with Compass connection. My favorites links have been working but today trying to connect to the class’s Atlas cluster to answer a quiz question, I got the error message – 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.

I’ll try to go forward using a shell connection instead but really want to get the Compass connection working again. No idea how to do that.

Use one of these two connection strings in Compass and you’ll be fine going forward:

  • mongodb://,,

  • mongodb+srv://

1 Like


Oddly, my favorites connection sprang to life and worked again!

But if the failure reoccurs I’ll know what to do.

Again - many thanks.

There’s a difference between what you currently have (which can cause the error during a Primary node election) and what I shared above. Suggest changing your connection string or you’ll get the same error message in the future.

1 Like

Thanks for the heads up. I may just have to go back to Chapter 1 and start from scratch connecting first to the class’s Atlas database, then to my own, uploaded database in order to get new connection strings.

The connection string above is for the Class (public) cluster.
You can re-use the same connection string for your own Sandbox (private) cluster by changing the jxeqq part of the node(s) accordingly. Or get it directly from Atlas, no need to start from scratch.

Hi @Margaret_38982,

In addition to @007_jb,

Most likely your are directly connecting to a node in the cluster. Nodes can change their state form Primary to secondary and vice-a-versa from time to time due to various reasons.

So, you are able to connect fine when the node is in Primary state but when it switches to secondary state you get an error message.

Please make the changes recommended by @007_jb in the above post.

~ Shubham