MongoServerSelectionError: Fix for MongoDB Atlas
Workaround available Node.js, Python, Java, Compass Updated November 13, 2026Based on 4 user reportsHow we research
Quick answer
MongoServerSelectionError means the driver found no reachable server within 30 seconds. On Atlas it is nearly always the IP access list, DNS/SRV lookup, a firewall on 27017, or a paused cluster.
Most likely fix: Check the IP access list
How to fix it
Try these in order — the most common fix is first.
1. Check the IP access list
- Go to Security > Network Access and make sure your current public IP is listed and Active
Did this fix it?2. Test DNS and port
- Run dig SRV _mongodb._tcp.<cluster-host> (nslookup -q=SRV on Windows) and confirm one record per node
- Run nc -zv <node-hostname> 27017
Did this fix it?3. Switch to the standard connection string
- In the Connect dialog turn off the SRV Connection String toggle
- Use the mongodb:// string with all three hosts
Did this fix it?4. Fix connection pooling
- If you see 'too many open connections', reuse one MongoClient per process
- Set maxPoolSize or scale the cluster; M0 allows 500 connections
Did this fix it?5. Resume the cluster
- On Database > Clusters resume a paused cluster and wait until it is healthy
Did this fix it?
Symptoms
MongoServerSelectionError, ServerSelectionTimeoutError (PyMongo) or 'Server selection timed out after 30000 ms' when connecting or on the first query.
Why it happens
- IP not in the Atlas access list
- DNS or ISP blocking SRV lookups
- Outbound port 27017 blocked
- Cluster paused or deleted
- Wrong connection string or credentials
- Too many open connections
This guide also covers
- mongoserverselectionerror
- mongoserverselectionerror atlas
- server selection timed out after 30000 ms
- pymongo serverselectiontimeouterror atlas
Still not working?
If MongoDB Atlas keeps failing, you're not alone. See every MongoDB Atlas problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
- Supabase Max Client Connections Reached (Supabase)
- Firebase auth/invalid-api-key Error (Firebase)
Other MongoDB Atlas errors
- MongoDB Atlas Connection Timed Out (IP Not Whitelisted)
- MongoDB Atlas Authentication Failed (bad auth)
- MongoDB querySrv ENOTFOUND / ECONNREFUSED Error
- MongoDB Atlas Free Tier (M0) Limits and Throttling
- MongoDB Atlas Cluster Paused (Resume or Auto-Pause)
- MongoDB Atlas Unexpected Bill: Why It's So High
- MongoDB Atlas Too Many Connections Error
- MongoDB Atlas AWS VPC Peering Not Connecting