R
R
r8ze2020-07-04 08:40:12
JavaScript
r8ze, 2020-07-04 08:40:12

How to make top 10 players by balance variable?

Here I need to make the top of users, for example, according to the "balance" variable, the top should contain 10 users.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-07-04
@hzzzzl

mongoose

User
  .find({})
  .sort({ balance: 'desc' })
  .limit(10)

it is assumed that the players are already in the users collection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question