How-To
How to Query MongoDB Secondary Replica Set Members
in this article, we learn how to query a mongodb from a non master (slave or secondary) replica set member applies to mongodb replica set problem when issuing a simple query on a non master member, the user will see the following error error error { "$err" "not master and slaveok=false", "code" 13435 } what causes this error this is because, by default, mongodb does not permit read operations from a non master member in mongodb, reads to a primary provides data that reflects the latest writes at all times however, secondaries are not required to reflect the latest writes at all times and changes to the system can propagate gradually how to fix the error by running rs slaveok() , you are indicating to the system that you acknowledge that reads will eventually be consistent and you wish to be able to query the secondary anyway you learned the steps to "query mongodb secondary replica set members"