title: How to set rs.slaveOk() in secondary mongodb servers in replicaset via commandline?
body: <p>How to set rs.slaveOk() in secondary mongodb servers in replicaset via commandline?</p>
  
  <p>I tried following methods : </p>
  
  <p><code>${MONGO_HOME}/bin/mongo --port ${MONGO_PORT2} --host ${MONGO_SECONDARY2} --eval "printjson(rs.slaveOk())"</code></p>
  
  <p><code>${MONGO_HOME}/bin/mongo --port ${MONGO_PORT2} --host ${MONGO_SECONDARY2} --eval "printjson(rs.slaveOk(true))"</code></p>
  
  <p><code>${MONGO_HOME}/bin/mongo --port ${MONGO_PORT2} --host ${MONGO_SECONDARY2} --eval "printjson(db.getSiblingDB('admin').getMongo().setSlaveOk())"</code></p>
  
  <p>the command executes with <code>undefined</code> in the output log.
  I am trying to set this via the shell in primary server.</p>