mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
fix getSortedSetRange() if start>0 and stop is -1
This commit is contained in:
@@ -141,8 +141,13 @@ module.exports = function(db, module) {
|
|||||||
key = {$in: key};
|
key = {$in: key};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var limit = stop - start + 1;
|
||||||
|
if (limit <= 0) {
|
||||||
|
limit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
db.collection('objects').find({_key: key}, {fields: fields})
|
db.collection('objects').find({_key: key}, {fields: fields})
|
||||||
.limit(stop - start + 1)
|
.limit(limit)
|
||||||
.skip(start)
|
.skip(start)
|
||||||
.sort({score: sort})
|
.sort({score: sort})
|
||||||
.toArray(function(err, data) {
|
.toArray(function(err, data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user