title: How To assign priority to mongodb 3.2 replica?
body: <p>I have mongodb database with replication(1 primary and 4 secondary machine named as node1, node2,node3, node4 and node5 ). I want to assign priority to nodes. If <code>node1</code> goes down then <code>node2</code> should become primary If <code>node1</code> and <code>node2</code> goes down then <code>node3</code> should become primary and so on.
  I am trying to assign priority Using below command but it is not changing:</p>
  
  <pre><code>cfg = rs.conf()
  cfg.members[0].priority = 20
  cfg.members[1].priority = 15
  cfg.members[2].priority = 10
  cfg.members[3].priority = 5
  cfg.members[4].priority = 1
  rs.reconfig(cfg)
  </code></pre>
  
  <p>I am using Mongodb version: 3.2</p>