I'm trying to set to 0 the number of votes of a replica set member via a mongo shell connected to the primary, but i get an error when i call:
rstest:PRIMARY> rs.reconfig(conf)
{
"ok" : 0,
"errmsg" : "priority must be 0 when non-voting (votes:0)",
"code" : 103
}
What i do is:
rstest:PRIMARY> conf = rs.conf()
... //the conf document
rstest:PRIMARY> conf.members[0].votes = 0
rstest:PRIMARY> rs.reconfig(conf)
Where conf.members[0] is the SECONDARY's doc conf
At this link the MongoDB's documentation says:
...
cfg = rs.conf() cfg.members[3].votes = 0 cfg.members[4].votes = 0 cfg.members[5].votes = 0 rs.reconfig(cfg)
This sequence gives 0 votes to the fourth, fifth, and sixth members of the set according to the order of the members array in the output of rs.conf(). This setting allows the set to elect these members as primary but does not allow them to vote in elections.
...
But the error message returned says that i have to set priority=0 for non-voting, but this implicate that member cannot be a primary.
What I did not understand or where am I doing wrong?
Thanks a lot