From d2c2d56f59bf4cf84bcadd9b564d9aaa550f8517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 15 Dec 2018 00:57:51 -0500 Subject: [PATCH] feat: change sortedSetsScore --- src/database/mongo/sorted.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index ab69a7f7fa..8ecbb1b129 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -273,16 +273,18 @@ module.exports = function (db, module) { return callback(err); } - var map = helpers.toMap(result); - var returnData = []; - var item; + var map = {}; + result.forEach(function (item) { + if (item) { + map[item._key] = item; + } + }); - for (var i = 0; i < keys.length; i += 1) { - item = map[keys[i]]; - returnData.push(item ? item.score : null); - } + result = keys.map(function (key) { + return map[key] ? map[key].score : null; + }); - callback(null, returnData); + callback(null, result); }); };