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

c++ - CPP, 'X' button listener -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -

shared memory - gstreamer shmsrc and shmsink with h264 data -