If you’ve connected to a hosted MongoDB instance, chances are you’ve experienced the odd 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:

MongoChef set connection idle timeout

After that, your connection should no longer drop 🙂

Connect to your MongoDB instance with Studio 3T, the most convenient MongoDB GUI. Download it now and complement this neat trick with other time-saving hacks like how to copy and paste documents across databases and servers and how to grant a MongoDB role to multiple users at once.

Download Studio 3T
Get Download Link for Later

Editor’s Note: This post was originally published in October 2015.