server_description – An object representation of a server the driver is connected to.

Represent one server the driver is connected to.

class pymongo.server_description.ServerDescription

Immutable representation of one server.

Parameters:
  • address (_Address) – A (host, port) pair

  • hello (Optional[Hello]) – Optional Hello instance

  • round_trip_time (Optional[float]) – Optional float

  • error (Optional[Exception]) – Optional, the last error attempting to connect to the server

  • round_trip_time – Optional float, the min latency from the most recent samples

  • min_round_trip_time (float)

property address: Tuple[str, int | None]

The address (host, port) of this server.

property all_hosts: set[tuple[str, int]]

List of hosts, passives, and arbiters known to this server.

property error: Exception | None

The last error attempting to connect to the server, or None.

property min_round_trip_time: float

The min latency from the most recent samples.

property primary: tuple[str, int] | None

This server’s opinion about who the primary is, or None.

property replica_set_name: str | None

Replica set name or None.

property retryable_reads_supported: bool

Checks if this server supports retryable writes.

property retryable_writes_supported: bool

Checks if this server supports retryable writes.

property round_trip_time: float | None

The current average latency or None.

property server_type: int

The type of this server.

property server_type_name: str

The server type as a human readable string.

Added in version 3.4.