MongoDB Compass error. 'not master and slaveOk=false'
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.
Start mongod
process.
Start mongo
process.
On the mongo
shell you have opened type first rs.status()
then rs.initiate()
then rs.status()
.