pool – Pool module for use with a MongoDB client.

class pymongo.pool.PoolOptions

Read only connection pool options for a MongoClient.

Should not be instantiated directly by application developers. Access a client’s pool options via pool_options instead:

pool_opts = client.options.pool_options
property appname

The application name, for sending with hello in server handshake.

property connect_timeout

How long a connection can take to be opened before timing out.

property driver

Driver name and version, for sending with hello in handshake.

property load_balanced

True if this Pool is configured in load balanced mode.

property max_connecting

The maximum number of concurrent connection creation attempts per pool. Defaults to 2.

property max_idle_time_seconds

The maximum number of seconds that a connection can remain idle in the pool before being removed and replaced. Defaults to None (no limit).

property max_pool_size

The maximum allowable number of concurrent connections to each connected server. Requests to a server will block if there are maxPoolSize outstanding connections to the requested server. Defaults to 100. Cannot be 0.

When a server’s pool has reached max_pool_size, operations for that server block waiting for a socket to be returned to the pool. If waitQueueTimeoutMS is set, a blocked operation will raise ConnectionFailure after a timeout. By default waitQueueTimeoutMS is not set.

property metadata

A dict of metadata about the application, driver, os, and platform.

property min_pool_size

The minimum required number of concurrent connections that the pool will maintain to each connected server. Default is 0.

property non_default_options

The non-default options this pool was created with.

Added for CMAP’s PoolCreatedEvent.

property server_api

A pymongo.server_api.ServerApi or None.

property socket_timeout

How long a send or receive on a socket can take before timing out.

property tls_allow_invalid_hostnames

If True skip ssl.match_hostname.

property wait_queue_timeout

How long a thread will wait for a socket from the pool if the pool has no free sockets.