2

I have just created a MongoDB Atlas instance so that I can give MongoDB a try. I have also downloaded Compass so that I can visually manage the data as I am not familiar with the MongoDB command line at the moment.

After white-listing my IP address in the Atlas dashboard and copying and pasting the connection details I am still unable to fully use the Compass client.

The error that I am receiving is: 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.

The operating system on which I am using the Compass client is Windows 10. I am unsure if this is caused by a misconfiguration or something else, however everything is clean and freshly setup.

I would appreciate any tips.

Regards

  • Based on the error message, it looks like the connection details you are using in Compass do not include the Atlas replica set name and that you are directly connecting to a member of the replica set which is currently a secondary. Direct connections (i.e. those not using the replica set name) do not perform any topology discovery or failover, and you must set a secondary read preference if you are not connected to the current primary. Assuming you don't want a readonly connection, you can correct this problem by setting Replica Set Name in the Compass connection dialog. – Stennie Feb 23 '18 at 22:31
  • Tip: if you copy a connection string from Atlas, Compass should detect that you have a connection string on your clipboard and offer to use that to fill out the connection details for you. – Stennie Feb 23 '18 at 22:31
3

I received the same error when trying to connect with Compass (version 1.13.1) to a secondary node.

It worked after I changed the connection Hostname to the Primary server, specified the Replica Set Name and select "Secondary Preferred" for the Read Preference.

This seems to be a new feature as older versions of Compass allowed direct connections to secondary nodes without complaint.

  • How to find out the Primary server? – Kashif Khan Apr 11 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.