Mongo.setSlaveOk()

  • Mongo.setSlaveOk()
  • For the current session, this command permits read operations fromsecondary instances. Practically, use this method in thefollowing form:
  1. db.getMongo().setSlaveOk()

Indicates that “eventually consistent” read operations are acceptable for the currentapplication. This function provides the same functionality asrs.slaveOk().

See the readPref() method for morefine-grained control over read preference in the mongo shell.