There's no automatic way. You would have to call isMaster on the primary
and then try to connect to each of the hosts in the host list.
That is one reason we have the w="majority" option: it has almost the same
safety properties as w=(total # of members) but will still work if a node
is down.
On Friday, July 27, 2012 1:37:42 AM UTC-4, Benk wrote:
> Hi:
> when I use replica set , and make w=3 when use the c++ client to insert
> data , if one of the mongod down
> ,How to get the number of current servers which are not down from the c++ client
> ?
> ------------------------------
> gmail