diff --git a/src/database/mongo/hash.js b/src/database/mongo/hash.js index d116038bf9..cf6c55bc58 100644 --- a/src/database/mongo/hash.js +++ b/src/database/mongo/hash.js @@ -136,14 +136,13 @@ module.exports = function(db, module) { }; module.incrObjectFieldBy = function(key, field, value, callback) { + callback = callback || function() {}; var data = {}; field = helpers.fieldToString(field); data[field] = value; db.collection('objects').findAndModify({_key:key}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) { - if(typeof callback === 'function') { - callback(err, result ? result[field] : null); - } + callback(err, result ? result[field] : null); }); }; }; \ No newline at end of file diff --git a/src/database/redis/sorted.js b/src/database/redis/sorted.js index 7c647bf1c3..1ddc1fc6f4 100644 --- a/src/database/redis/sorted.js +++ b/src/database/redis/sorted.js @@ -125,11 +125,7 @@ module.exports = function(redisClient, module) { multi[reverse ? 'zrevrange' : 'zrange']('temp', start, stop); multi.del('temp'); multi.exec(function(err, results) { - if (!err && typeof callback === 'function') { - callback(null, results[1]); - } else if (err) { - callback(err); - } + callback(err, results ? results[1] : null); }); } }; \ No newline at end of file