Hi Shane,

thank you so much for your answer.

This is how we are initialising the client:

url = "secondary_1:27017,secondary2:27017,primary:27017/database"
uri = f"mongodb://{user}:{password}@{url}"
client = pymongo.MongoClient(
    uri, 
    readPreference='secondaryPreferred',
    maxPoolSize=max_pool_size, # default to 100
    socketTimeoutMS=socket_timeout, # default to 60000
    connectTimeoutMS=connect_timeout # default to 60000
)

There are sometimes thousands of simultaneous jobs running on different clusters in different sites.

I understand now the behaviour of pymongo>=4.0, and the origin of all these connections to the primary ( a lot of them ! ). Still, I am quite sure that we used to run with the same settings with pymongo==3.13.0, and never got any connection to the primary even with the seed list, but just to the two secondaries. :confused: Any idea how that could happen?

Best,
Carlo