mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
add reverse support to db.processSortedSet (#11826)
This commit is contained in:
committed by
GitHub
parent
8ab9c72c6b
commit
9b1cc57604
@@ -563,12 +563,12 @@ module.exports = function (module) {
|
||||
let done = false;
|
||||
const ids = [];
|
||||
const project = { _id: 0, _key: 0 };
|
||||
|
||||
const sort = options.reverse ? -1 : 1;
|
||||
if (!options.withScores) {
|
||||
project.score = 0;
|
||||
}
|
||||
const cursor = await module.client.collection('objects').find({ _key: setKey }, { projection: project })
|
||||
.sort({ score: 1 })
|
||||
.sort({ score: sort })
|
||||
.batchSize(options.batch);
|
||||
|
||||
if (processFn && processFn.constructor && processFn.constructor.name !== 'AsyncFunction') {
|
||||
|
||||
Reference in New Issue
Block a user