We have an app built using node.js, mongo with mongoose. We have a replicated test database set up. We are using connect-mongostore for session management in express. I'm trying to get my database to timeout when it goes away. So, if connect with my app, (uses rest services,) then kill mongo on both the primary and secondary server, then I would like to timeout the request between node and mongo to return the error. However, it never seems to do that.
Any ideas?
Here is what I have so far:
For connect mongostore, for session:
"servers":[{"host":"rs0_primary.myapi.com","port":27017,"options":{"autoReconnect":true,"socketOptions":{"connectTimeoutMS":10000,"socketTimeoutMS":10000,"keepAlive":1,"encoding":"utf8"}}},{"host":"rs0_secondary.myapi.com","port":27017,"options":{"autoReconnect":true,"socketOptions":{"connectTimeoutMS":10000,"socketTimeoutMS":10000,"keepAlive":1,"encoding":"utf8"}}}]
For mongoose:
mongodb://user1:password1@rs0_primary.myapi.com/stuff,user1:password1@rs0_secondary.myapi.com/esp?replicaSet=rs0&connectTimeoutMS=10000&socketTimeoutMS=10000