fix/BSONError: cyclic dependency detected
This commit is contained in:
3 files changed
+9
-30
No files matched your search
+4
-16
@@ -55,27 +55,15 @@ module.exports = {
|
||||
let leaderboard = [];
|
||||
if (category == 'money') {
|
||||
|
||||
const usersCursor = await client.dbo.collection("users").aggregate([
|
||||
leaderboard = await client.dbo.collection("users").aggregate([
|
||||
{ $sort: { [`user.guilds.${GuildDB.serverID}.balance`]: -1 } }
|
||||
]);
|
||||
|
||||
let i = 0;
|
||||
for await (const user of usersCursor) {
|
||||
if (i == limit) break;
|
||||
leaderboard.push(user);
|
||||
}
|
||||
]).toArray();
|
||||
|
||||
} else {
|
||||
|
||||
const playersCursor = await client.dbo.collection("players").aggregate([
|
||||
leaderboard = await client.dbo.collection("players").aggregate([
|
||||
{ $sort: { [`${category}`]: -1 } }
|
||||
]);
|
||||
|
||||
let i = 0;
|
||||
for await (const player of playersCursor) {
|
||||
if (i == limit) break;
|
||||
leaderboard.push(player);
|
||||
}
|
||||
]).toArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user