mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
removed couple RDB.multis
This commit is contained in:
@@ -439,6 +439,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
module.sortedSetRank = function(key, value, callback) {
|
||||
module.getSortedSetRange(key, 0, -1, function(err, result) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
var rank = result.indexOf(value);
|
||||
if(rank === -1) {
|
||||
return callback(null, null);
|
||||
}
|
||||
|
||||
callback(null, rank);
|
||||
});
|
||||
}
|
||||
|
||||
// lists
|
||||
module.listPrepend = function(key, value, callback) {
|
||||
module.isObjectField(key, 'array', function(err, exists) {
|
||||
@@ -471,6 +485,26 @@
|
||||
});
|
||||
}
|
||||
|
||||
module.listRemoveLast = function(key, callback) {
|
||||
module.getListRange(key, -1, 0, function(err, value) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
db.collection('objects').update({_key: key }, { $pop: { array: 1 } }, function(err, result) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if(value && value.length) {
|
||||
callback(err, value[0]);
|
||||
} else {
|
||||
callback(err, null);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.getListRange = function(key, start, stop, callback) {
|
||||
|
||||
if(stop === -1) {
|
||||
|
||||
Reference in New Issue
Block a user