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 pool_opts.max_pool_size pool_opts.min_pool_size
-
appname
¶ The application name, for sending with hello in server handshake.
-
connect_timeout
¶ How long a connection can take to be opened before timing out.
-
driver
¶ Driver name and version, for sending with hello in handshake.
-
load_balanced
¶ True if this Pool is configured in load balanced mode.
-
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).
-
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 raiseConnectionFailure
after a timeout. By defaultwaitQueueTimeoutMS
is not set.
-
metadata
¶ A dict of metadata about the application, driver, os, and platform.
-
min_pool_size
¶ The minimum required number of concurrent connections that the pool will maintain to each connected server. Default is 0.
-
non_default_options
¶ The non-default options this pool was created with.
Added for CMAP’s
PoolCreatedEvent
.
-
server_api
¶ A pymongo.server_api.ServerApi or None.
-
socket_keepalive
¶ Whether to send periodic messages to determine if a connection is closed.
-
socket_timeout
¶ How long a send or receive on a socket can take before timing out.
-
ssl_match_hostname
¶ Call ssl.match_hostname if cert_reqs is not ssl.CERT_NONE.
-
wait_queue_multiple
¶ Multiplied by max_pool_size to give the number of threads allowed to wait for a socket at one time.
-
wait_queue_timeout
¶ How long a thread will wait for a socket from the pool if the pool has no free sockets.
-