client_options – Read only configuration options for a MongoClient.

Tools to parse mongo client options.

class pymongo.client_options.ClientOptions

Read only configuration options for a MongoClient.

Should not be instantiated directly by application developers. Access a client’s options via pymongo.mongo_client.MongoClient.options instead.

Parameters:
  • username (str)

  • password (str)

  • database (Optional[str])

  • options (Mapping[str, Any])

property auto_encryption_opts: AutoEncryptionOpts | None

A AutoEncryptionOpts or None.

property codec_options: CodecOptions

A CodecOptions instance.

property connect: bool | None

Whether to begin discovering a MongoDB topology automatically.

property direct_connection: bool | None

Whether to connect to the deployment in ‘Single’ topology.

property event_listeners: list[_EventListeners]

The event listeners registered for this client.

See monitoring for details.

Added in version 4.0.

property heartbeat_frequency: int

The monitoring frequency in seconds.

property load_balanced: bool | None

True if the client was configured to connect to a load balancer.

property local_threshold_ms: int

The local threshold for this instance.

property pool_options: PoolOptions

A PoolOptions instance.

property read_concern: ReadConcern

A ReadConcern instance.

property read_preference: _ServerMode

A read preference instance.

property replica_set_name: str | None

Replica set name or None.

property retry_reads: bool

If this instance should retry supported read operations.

property retry_writes: bool

If this instance should retry supported write operations.

property server_monitoring_mode: str

The configured serverMonitoringMode option.

Added in version 4.5.

property server_selection_timeout: int

The server selection timeout for this instance in seconds.

property timeout: float | None

The configured timeoutMS converted to seconds, or None.

Added in version 4.2.

property write_concern: WriteConcern

A WriteConcern instance.