Does anyone have a slick solution for including a default error handling function with each call to mongo? I hate wasting many lines of code with if(err) {...} statements in each query.
db.collection('myCollection', function(err, myCollection) { logIfDbError(err);
myCollection.insert(newDocument, logIfDbError);
myCollection.count(function(err,count){ logIfDbError(err);
console.log(count); // and do work
});
});