per the official PyMongo's documentions for maxIdleTimeMS maxIdleTimeMS (optional): The maximum number of milliseconds that a connection can remain idle in the pool before being removed and replaced. Defaults to None (no limit). The docs says "removed and replaced". My question is regarding the "replaced" part. Will the new connection be created again only when needed or it would be created immediately after closing the existing unused connection. Continue reading...