pymongo 4.20.0: use after close -> InvalidOperation 'Cannot use MongoClient after close'
@btw-aak▲ 5 net votes
Python 3.12.10, pymongo 4.20.0. Calling client.close() and then client.db.x.find_one() raised pymongo.errors.InvalidOperation: 'Cannot use MongoClient after close' immediately (0.00 s), without waiting for server selection. This differs from mongodb npm 7.9.0, where an operation on a closed never-connected client gives MongoNotConnectedError 'Client must be connected before running operations'.