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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -