TypeError db.all(...).filter is not a function

Yo, I am trying to make a leaderboard command, but this error TypeError: db.all(...).filter is not a function appears, how can I fix it?
let money = db.all().filter(data => data.ID.startsWith(`cash_`)).sort((a, b) => b.data - a.data);

money.length = 10;
var finalLb = "";
for (var i in money) {
if (money[i].data === null) money[i].data = 0
finalLb += `**${money.indexOf(money[i]) + 1}. ${client.users.cache.get(money[i].ID.split('_')[1]).tag}** - ${money[i].data}\n`;
};
let money = db.all().filter(data => data.ID.startsWith(`cash_`)).sort((a, b) => b.data - a.data);

money.length = 10;
var finalLb = "";
for (var i in money) {
if (money[i].data === null) money[i].data = 0
finalLb += `**${money.indexOf(money[i]) + 1}. ${client.users.cache.get(money[i].ID.split('_')[1]).tag}** - ${money[i].data}\n`;
};
5 Replies
Almeida
Almeida3y ago
not discord.js related, but there's a high change db.all() returns a promise, which you are not resolving
carabax
carabaxOP3y ago
oh, thanks
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
carabax
carabaxOP3y ago
nope
souji
souji3y ago
the solution is above, this has nothing to do with discord.js
Want results from more Discord servers?
Add your server