ServerSelectionTimeoutError
Python (PyMongo)ConnectionFailureconnectivitytopologytimeout
No MongoDB server matching the selection criteria was found within serverSelectionTimeoutMS
What is happening?
ServerSelectionTimeoutError is PyMongo's equivalent of MongoServerSelectionError in the Node.js driver. It means the driver could not find a suitable server (matching topology type and read preference) within the timeout period. The error message includes a description of all known servers and their states.
Common causes
- MongoDB server not running or not reachable
- Incorrect connection URI
- IP not in Atlas access list
- DNS resolution failure for SRV URIs
- Firewall blocking port 27017
- Authentication failure preventing topology discovery
- Read preference cannot be satisfied