Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
//opens the stats collection
var openStats = function(err, stats) {
if (err) return console.log('error opening stats %o', err);
//when a new request occurs
stats.update({name: 'reqcount'}, {'$inc': {value: 1}}, {safe: true}, function() { });
//opens the database
var db = new Db('musictv', replSet); {
console.log('database opened');
if (err) return console.log('database error %o', err);
db.collection('stats', openStats);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment