Skip to content

Node.js based forum software built for the modern web

getSortedSetRevRangeWithScores

barisusakli9d7a8fcc0b96
diff --git a/src/database/level/sorted.js b/src/database/level/sorted.js
index 7d68a5cc59..d06ee49206 100644
--- a/src/database/level/sorted.js
+++ b/src/database/level/sorted.js
@@ -64,7 +64,13 @@ module.exports = function(db, module) {
};
module.getSortedSetRevRangeWithScores = function(key, start, stop, callback) {
- // should return [{value:"test", score: 2}, {value: "foo", score: 1}, ...]
+ module.getListRange(key, start, stop, function(err, set) {
+ if (err) {
+ return callback(err);
+ }
+ set.sort(function(a, b) {return b.score - a.score;});
+ callback(null, set);
+ })
};
module.getSortedSetRangeByScore = function(key, start, count, min, max, callback) {