Try Studio 3T for Free
  1. Knowledge Base
  2. MongoDB Tutorials
  3. Connecting to MongoDB
  4. How to Prevent a MongoDB Connection Timeout

How to Prevent a MongoDB Connection Timeout

Check out this page for our Studio 3T connections overview.

If you’ve connected to a hosted instance, chances are you’ve experienced the odd MongoDB connection timeout or drop.

After a relatively short period of inactivity, you might try to run a query from within Studio 3T, but are presented with a server error message box.

If you try again, the query will work properly again.

The reason is that in some configurations, the connection can get dropped by a firewall or a load balancer. This issue is common with MongoDBs hosted on Azure.

The folks over at mLab have some interesting details on this matter: http://docs.mlab.com/connecting/#known-issues.

The solution is to manually set the max connection idle time to 60s (60000ms) in the Connection Manager:

After that, your connection should no longer drop 🙂


Check out these other Studio 3T tips:

Updated on July 30, 2019

Was this article helpful?

Related Articles

Leave a Comment