pool – Pool module for use with a MongoDB connection.

class pymongo.pool.Pool(host, max_size, net_timeout, conn_timeout, use_ssl)

A simple connection pool.

Uses thread-local socket per thread. By calling return_socket() a thread can return a socket to the pool.

connect()

Connect to Mongo and return a new (connected) socket.

discard_socket()

Close and discard the active socket.

get_socket()

Get a socket from the pool. Returns a new socket if the pool is empty.

return_socket()

Return the socket currently in use to the pool. If the pool is full the socket will be discarded.

Previous topic

message – Tools for creating messages to be sent to MongoDB

Next topic

replica_set_connection – Tools for connecting to a MongoDB replica set

This Page