If you are connected to a hosted MongoDB instance, you may experience odd connection drops or timeouts.

After a relatively short period of inactivity, you try to run a query from within Studio 3T (formerly MongoChef), but you 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 🙂

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.

MongoChef is now Studio 3T. Learn more HERE!