When trying to access MongoDB database collection data using command such as show collections on one of the secondary member of the replica set, error message such as not master and slaveOk=false occurs. Following screenshot represents the same:

Figure 1. MongoDB – SlaveOk Error Message
Following command when executed on secondaries resolves the above shown error:
rs.slaveOk();
Latest posts by Ajitesh Kumar (see all)
- GPT Models In-context Learning: Examples - June 5, 2023
- OpenAI GPT-3 Models List: Explained with Examples - June 4, 2023
- Difference between Parametric vs Non-Parametric Models - June 3, 2023
Leave a Reply