|
|
|
@ -410,4 +410,18 @@ module.exports = function(db, module) {
|
|
|
|
|
callback(null, data);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.sortedSetIncrBy = function(key, increment, value, callback) {
|
|
|
|
|
callback = callback || helpers.noop;
|
|
|
|
|
if (!key) {
|
|
|
|
|
return callback();
|
|
|
|
|
}
|
|
|
|
|
var data = {};
|
|
|
|
|
value = helpers.fieldToString(value);
|
|
|
|
|
data['score'] = parseInt(increment, 10);
|
|
|
|
|
|
|
|
|
|
db.collection('objects').findAndModify({_key: key, value: value}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) {
|
|
|
|
|
callback(err, result ? result[value] : null);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
};
|