MongoDB tip: 4 ways to modify replica set configuration
This is just a quick guide on how to modify your replica set settings in 4 different ways. This guide is assuming you have a functional replica set ready, it doesn't matter if it's a single node or multi-node replica set. In each of the four method, I am looking to modify the priority of the _id=0 node Method 1: Via Mongo Shell Login to your Mongo shell, simply type in mongo , assuming default port is being used and authentication is not enabled [in Mongo shell] cfg = rs.conf() cfg.members[0].priority=99 rs.reconfig(cfg) # "ok":1 indicates the new configuration has been set MongoDB Enterprise minvera:PRIMARY> rs.reconfig(cfg) { "ok" : 1, "operationTime" : Timestamp(1528464949, 1), "$clusterTime" : { "clusterTime" : Timestamp(1528464949, 1), ...