Centos – How to change priority between master and Slave MongoDB

Scenario 1: 3 or more Mongodb node servers

Member 0 priority = 15
Member 1 priority = 10
Member 2 priority = 5

In situation when primary server is crushes the secondary server automatically

cfg = rs.conf()
cfg.members[0].priority = 15
cfg.members[1].priority = 10
cfg.members[2].priority = 5
rs.reconfig(cfg)

In this scenario 1 server is crashes  automatically  server (cfg.members[1].priority = 10)  become primary

Scenario 2: 2  Servers 1 Master and 1 Slave