Loading...
Searching...
No Matches
mongocxx::events::topology_description Class Reference

`#include <mongocxx/v_noabi/mongocxx/events/topology_description.hpp>`

## Description

A description of the topology of one or more connected MongoDB servers.

See also
  - mongocxx::v_noabi::events::topology_changed_event

## Classes

class | server_descriptions
| An array of server_description instances. More...

## Public Member Functions

| topology_description (v1::events::topology_description const &td)
| Construct with the mongocxx::v1 equivalent.
bool | has_readable_server (v_noabi::read_preference const &pref) const
| Determines if the topology has a readable server available. Servers are filtered by the given read preferences only if the driver is connected to a replica set, otherwise the read preferences are ignored. This function uses the driver's current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O.
bool | has_writable_server () const
| Determines if the topology has a writable server available, such as a primary, mongos, or standalone. This function uses the driver's current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O.
| operator v1::events::topology_description () const
| Convert to the mongocxx::v1 equivalent.
server_descriptions | servers () const
| Fetches descriptions for all known servers in the topology.
bsoncxx::v_noabi::stdx::string_view | type () const
| The topology type: "Unknown", "Sharded", "ReplicaSetNoPrimary", "ReplicaSetWithPrimary", or "Single".

## Constructor & Destructor Documentation

## topology_description()

mongocxx::v_noabi::events::topology_description::topology_description | ( | v1::events::topology_description const & | td | ) |

inline

Construct with the mongocxx::v1 equivalent.

## Member Function Documentation

## has_readable_server()

bool mongocxx::v_noabi::events::topology_description::has_readable_server | ( | v_noabi::read_preference const & | pref | ) | const

Determines if the topology has a readable server available. Servers are filtered by the given read preferences only if the driver is connected to a replica set, otherwise the read preferences are ignored. This function uses the driver's current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O.

Returns
  Whether there is a readable server available.

## has_writable_server()

bool mongocxx::v_noabi::events::topology_description::has_writable_server | ( |  | ) | const

inline

Determines if the topology has a writable server available, such as a primary, mongos, or standalone. This function uses the driver's current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O.

Returns
  Whether there is a writable server available.

## operator v1::events::topology_description()

mongocxx::v_noabi::events::topology_description::operator v1::events::topology_description | ( |  | ) | const

inline explicit

Convert to the mongocxx::v1 equivalent.

## servers()

server_descriptions mongocxx::v_noabi::events::topology_description::servers | ( |  | ) | const

Fetches descriptions for all known servers in the topology.

Returns
  An array of server_description objects.

## type()

bsoncxx::v_noabi::stdx::string_view mongocxx::v_noabi::events::topology_description::type | ( |  | ) | const

inline

The topology type: "Unknown", "Sharded", "ReplicaSetNoPrimary", "ReplicaSetWithPrimary", or "Single".

Returns
  The type as a short-lived string view.

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

- mongocxx/v_noabi/mongocxx/events/topology_description.hpp