I keep hitting my connection limit, but http traffic has remained consistent. I used MMS to profile my mongod process and saw that the number of connections keeps rising:
I'm using the mongoskin wrapper for Node.js (Express). I have a piece of custom route middleware that connects to the mongo db before executing other routes:
var _connect = function(req, res, next) {
res.db = mongoskin.db(_us.sprintf(
'%s:%s@localhost:27017/%s?auto_reconnect',
app.set('mongoDbUser'),
app.set('mongoDbPw'),
app.set('mongoDb')
));
next();
};
Am I doing something wrong? How should I be opening and closing connections?