LTRIM support for mongo

v1.18.x
psychobunny 11 years ago
parent 7327730252
commit 60e74cc2c3

@ -43,6 +43,23 @@ module.exports = function(db, module) {
});
};
module.listTrim = function(key, start, stop, callback) {
module.getListRange(key, start, stop, function(err, value) {
if(err) {
if(typeof callback === 'function') {
return callback(err);
}
return;
}
db.collection('objects').update({_key: key}, {$set: value}, function(err, result) {
if(typeof callback === 'function') {
callback(err, (value && value.length) ? value[0] : null);
}
});
});
};
module.listRemoveAll = function(key, value, callback) {
value = helpers.valueToString(value);

Loading…
Cancel
Save