|
The setVersion is the replica set config version, and is used to detect the most up-to-date set of hosts from isMaster:
> db.isMaster()
|
{
|
"setName" : "test7",
|
"setVersion" : 1,
|
"ismaster" : true,
|
"secondary" : false,
|
"hosts" : [
|
"pans.local:27017"
|
],
|
"primary" : "pans.local:27017",
|
"me" : "pans.local:27017",
|
"maxBsonObjectSize" : 16777216,
|
"maxMessageSizeBytes" : 48000000,
|
"maxWriteBatchSize" : 1000,
|
"localTime" : ISODate("2014-04-10T11:18:24.922Z"),
|
"maxWireVersion" : 2,
|
"minWireVersion" : 0,
|
"ok" : 1
|
}
|
> var c = rs.conf()
|
> c.version++
|
> rs.reconfig(c)
|
{ "ok" : 1 }
|
> db.isMaster()
|
{
|
"setName" : "test7",
|
"setVersion" : 2,
|
"ismaster" : true,
|
"secondary" : false,
|
"hosts" : [
|
"pans.local:27017"
|
],
|
"primary" : "pans.local:27017",
|
"me" : "pans.local:27017",
|
"maxBsonObjectSize" : 16777216,
|
"maxMessageSizeBytes" : 48000000,
|
"maxWriteBatchSize" : 1000,
|
"localTime" : ISODate("2014-04-10T11:18:54.346Z"),
|
"maxWireVersion" : 2,
|
"minWireVersion" : 0,
|
"ok" : 1
|
}
|
It is not meant to be used to detect the current primary, or member states, just the configuration version.
If you want a new indicator for when election events happen that would be a new thing. We do have something like this in sharding already. Please create a new issue for that request so it will be clear.
|