Seren_Modz 21
10/10/2021, 4:43 AMconst leveling = await prisma.leveling.findMany({ orderBy: { totalXp: "desc" } })
const index = leveling.findIndex((l) => l.userId === user.id)
the problem with it, is that as the table scales, finding the index is going to become very slow as its fetching the whole table.Ryan
10/11/2021, 6:03 AMwhere condition to find the value and return if it matches.Seren_Modz 21
10/11/2021, 10:27 PMwhere wouldn't find the index though, its not really the user data I want to get
as shown above, i am currently using Array#findIndex() to find the index of the user, which then is used to show their rank position on their rank card, then there not having to look at the leaderboard