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

  • check_compatible()

    Raise ConfigurationError if any server is incompatible.

    A server is incompatible if its wire protocol version range does not overlap with PyMongo’s.

  • property common_wire_version

    Minimum of all servers’ max wire versions, or None.

  • property has_known_servers

    Whether there are any Servers of types besides Unknown.

  • has_readable_server(read_preference=Primary())

    Does this topology have any readable servers available matching the given read preference?

    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.

  • property known_servers

    List of Servers of types besides Unknown.

  • property logical_session_timeout_minutes

    Minimum logical session timeout, or None.

  • property max_election_id

    Greatest electionId seen from a primary, or None.

  • property max_set_version

    Greatest setVersion seen from a primary, or None.

  • property readable_servers

    List of readable Servers.

  • property replica_set_name

    The replica set name.

  • reset()

    A copy of this description, with all servers marked Unknown.

  • reset_server(address)

    A copy of this description, with one server marked Unknown.

  • server_descriptions()

    Dict of (address, ServerDescription).

  • property topology_type

    The type of this topology.

  • property topology_type_name

    The topology type as a human readable string.

    New in version 3.4.