topology_description
– An object representation of a deployment of MongoDB servers.¶
Represent a deployment of MongoDB servers.
- class pymongo.topology_description.TopologyDescription¶
Representation of a deployment of MongoDB servers.
- Parameters
topology_type: initial type
server_descriptions: dict of (address, ServerDescription) for all seeds
replica_set_name: replica set name or None
max_set_version: greatest setVersion seen from a primary, or None
max_election_id: greatest electionId seen from a primary, or None
topology_settings: a TopologySettings
- has_readable_server(read_preference=ReadPreference.PRIMARY)¶
Does this topology have any readable servers available matching the given read preference?
- Parameters
read_preference: an instance of a read preference from
read_preferences
. Defaults toPRIMARY
.
Note
When connected directly to a single server this method always returns
True
.New in version 3.4.
- has_writable_server()¶
Does this topology have a writable server available?
Note
When connected directly to a single server this method always returns
True
.New in version 3.4.
- server_descriptions()¶
Dict of (address,
ServerDescription
).
- topology_type¶
The type of this topology.
- topology_type_name¶
The topology type as a human readable string.
New in version 3.4.