A scalable, fully managed NoSQL database for JSON documents with fast queries and automatic indexing
DocumentDB not accessible, throwing ServerSelectionTimeout
Like nothing is there in the DB, created freshly, have no IP based or any sort of restrictions, yet this i9ssue is popping up.
Azure DocumentDB
-
Manoj Kumar Boyini • 19,590 Reputation points • Microsoft External Staff • Moderator
2026-06-15T13:26:37.6733333+00:00 I kindly request you to please share the details requested in the private message for further investigation.
Kindly run the following command from one of the affected client machines and share the output in Private message
PowerShell Test-NetConnection <server-hostname | ip-address> 10260
Connection with Mongosh: mongosh mongodb+srv://<user>:<password>@<accountName>.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000
check if DNS resolves to expected IPs $ nslookup -type=SRV _mongodb.tcp.<cluster-name>.<domain>
-
Debashish Behera • 5 Reputation points
2026-06-16T05:11:21.6033333+00:00 Tried them, the DNS is getting resolved, but the neither the Mongosh connection nor the Powershell connection is working out, both of them are throwing timeout errors.
Moreover I also have tried the following in Powershell :
python -c "from pymongo import MongoClient; print(MongoClient('mongodb+srv://**:**@***.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000').admin.command('ping'))"It is also not working
-
Manoj Kumar Boyini • 19,590 Reputation points • Microsoft External Staff • Moderator
2026-06-17T09:02:24.87+00:00 Since the DNS resolution is working but both mongosh and Test-NetConnection are timing out, I'd like to gather a few more details to help isolate where the connection is failing.
Could you please share:
- The exact error message returned by mongosh (including the IP address shown in the timeout message, if any).
- The output of:
nslookup -type=SRV _mongodb._tcp.<cluster-name>.mongocluster.cosmos.azure.com- The hostname returned by the SRV lookup and the result of:
nslookup <returned-hostname>- Whether you are connecting over public access or through a Private Endpoint.
- The result of:
Test-NetConnection <returned-hostname> -Port 10260This information will help determine whether the timeout is occurring because of network reachability, firewall restrictions, DNS routing, or endpoint accessibility.
Kindly share the results via Private Message, and I'll continue investigating.
-
Debashish Behera • 5 Reputation points
2026-06-17T10:47:31.96+00:00 I have tried the commands that you gave and all of them are working as you said. The issue is that I am unable to connect to the DB using mongo compass which was working earlier. Moreover how do I ensure that the database does not go down out of the blue next time ?
The biggest of them all :
In the azure console, I am seeing update failed which is for the upgradation of the MongoDB version in there (an upgrade from 7.0 to 8.0). Now that the DB is in the free tier and M10 cluster, I want to upgrade it to M30 cluster, having said that when I go on doing that the status being UpdateFailed, I am seeing the status as updating which is conflicting with the UpdateFailed status.
Moreover I have failed exactly this kind of issue earlier that the connection to DB is hitting ServerSelectionTimeout and after some time it is getting resolved automatically. We cannot go forward if this kind of is persisting with the DocumentDB instance.
-
VarunTha • 15,090 Reputation points • Microsoft External Staff • Moderator
2026-06-18T21:12:43.3933333+00:00 Hi Debashish Behera,
Thank you for your patience, and apologies for the delay. Based on the diagnostics shared so far, this does not appear to be a simple DNS issue, since DNS resolution is working and the main problem is the connection timeout from MongoDB Compass,
mongosh, and driver-based connections.From the details provided, the behaviour appears more consistent with the cluster being in an
UpdateFailed/Updatingstate during the MongoDB version upgrade. During an Updating operation, client connectivity can fail temporarily, and if that state persists, it may indicate that the update did not complete cleanly and requires deeper investigation.At this stage, we recommend not making any further scale or version changes until the cluster returns to a stable healthy state. If the resource continues to remain in
UpdateFailedorUpdating, this would need further service-side review for the affected cluster. -
Debashish Behera • 5 Reputation points
2026-06-24T06:59:04.4533333+00:00 Hi @VarunTha
As recommended, I have not tried to update the version at all, yet it is stuck in updating state and updatefailed state since last week. As the usage at our ends are rising, I need to update the DB cluster tier from M10 to M30, Please let me know if anything needs to be done from my end to get out of this issue.Apart from the version update, I have not done any change in any configurations for the DB.
Moreover Although the db is getting connected at times, yet most of the times it is throwing connection timed out, I have tried creating fresh documentDB instances in M10 and M20 tiers as well yet it is not working out, We cannot take the risk of losing the existing data in the DB, get me a way to bring the DB back to stability again.
Sign in to comment