Disable read operation ont the slave member for a mongodb replicaset -


rs.slaveok() enables read operation on slave member in mongodb replica set.

what function used disable it?

simply type rs.slaveok(false).

in shell can see code executed each command, if time rs.slaveok (without parenthesis) following:

rs.slaveok function (value) {     return db.getmongo().setslaveok(value); } 

so slaveok function accepts boolean parameter , recalls setslaveok, composed following code:

db.getmongo().setslaveok function (value) {     if (value == undefined)         value = true;     this.slaveok = value; } 

as see, setslaveok has true default value, specifying false can prevent reading secondary.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -