I'm building my first Node.js application and I've run into an issue with MongoDB. I'm using the MongoSkin driver.
Once I start my application it all works great. I can sit and toy with it for an hour and it will continue to work. However, if I let it sit for a few minutes without any activity then the next request will result in an error:
Error: connection closed at Server.connect.connectionPool.on.server._serverState (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\server.js:520:35) at EventEmitter.emit (events.js:126:20) at connection.on._self._poolState (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:109:15) at EventEmitter.emit (events.js:99:17) at Socket.closeHandler (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\connection.js:427:12) at Socket.EventEmitter.emit (events.js:96:17) at Socket._destroy.destroyed (net.js:358:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I've tried adding auto_reconnect=true
to the connection string as is suggested on the mongoskin documentation but that didn't help.