This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); | |
db.open(function(err) { | |
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