MongoDB C++ Driver  mongocxx-3.4.0
Public Member Functions | List of all members
mongocxx::events::server_description Class Reference

Class representing what the driver knows about a MongoDB server. More...

#include <server_description.hpp>

Public Member Functions

 ~server_description ()
 Destroys a server_description.
 
std::uint32_t id () const
 An opaque id, unique to this server for this mongocxx::client or mongocxx::pool. More...
 
std::int64_t round_trip_time () const
 The duration of the last isMaster call, indicating network latency. More...
 
bsoncxx::stdx::string_view type () const
 The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary", "RSSecondary", "RSArbiter", "RSOther", or "RSGhost". More...
 
bsoncxx::document::view is_master () const
 The server's last response to the "isMaster" command, or an empty document if the driver has not yet reached the server or there was an error. More...
 
bsoncxx::stdx::string_view host () const
 Returns the server host name. More...
 
std::uint16_t port () const
 Returns the server port. More...
 

Detailed Description

Class representing what the driver knows about a MongoDB server.

Member Function Documentation

◆ host()

bsoncxx::stdx::string_view mongocxx::events::server_description::host ( ) const

Returns the server host name.

Returns
The host name.

◆ id()

std::uint32_t mongocxx::events::server_description::id ( ) const

An opaque id, unique to this server for this mongocxx::client or mongocxx::pool.

Returns
The id.

◆ is_master()

bsoncxx::document::view mongocxx::events::server_description::is_master ( ) const

The server's last response to the "isMaster" command, or an empty document if the driver has not yet reached the server or there was an error.

Returns
The response as a short-lived document view.

◆ port()

std::uint16_t mongocxx::events::server_description::port ( ) const

Returns the server port.

Returns
The port.

◆ round_trip_time()

std::int64_t mongocxx::events::server_description::round_trip_time ( ) const

The duration of the last isMaster call, indicating network latency.

Returns
The duration in microseconds.

◆ type()

bsoncxx::stdx::string_view mongocxx::events::server_description::type ( ) const

The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary", "RSSecondary", "RSArbiter", "RSOther", or "RSGhost".

Returns
The type as a short-lived string view.

The documentation for this class was generated from the following file: