fix: #5570, create per category user post zsets

This commit is contained in:
Barış Soner Uşaklı
2019-06-24 15:21:43 -04:00
parent 4e513cf38a
commit a39f0ef592
15 changed files with 316 additions and 89 deletions

View File

@@ -162,6 +162,17 @@ module.exports = function (db, module) {
async.map(keys, module.sortedSetCard, callback);
};
module.sortedSetsCardSum = function (keys, callback) {
if (!keys || (Array.isArray(keys) && !keys.length)) {
return callback(null, 0);
}
db.collection('objects').countDocuments({ _key: Array.isArray(keys) ? { $in: keys } : keys }, function (err, count) {
count = parseInt(count, 10);
callback(err, count || 0);
});
};
module.sortedSetRank = function (key, value, callback) {
getSortedSetRank(false, key, value, callback);
};