Poco::MongoDB

class ReplicaSet

Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/ReplicaSet.h

Description

Class for working with a MongoDB replica set.

Member Summary

Member Functions: findMaster, isMaster

Constructors

ReplicaSet

explicit ReplicaSet(
    const std::vector < Net::SocketAddress > & addresses
);

Creates the ReplicaSet using the given server addresses.

Destructor

~ReplicaSet virtual

virtual ~ReplicaSet();

Destroys the ReplicaSet.

Member Functions

findMaster

Connection::Ptr findMaster();

Tries to find the master MongoDB instance from the addresses passed to the constructor.

Returns the Connection to the master, or null if no master instance was found.

isMaster protected

Connection::Ptr isMaster(
    const Net::SocketAddress & host
);