$dbTop is the leaderboard query. On a large collection, index the field first.
$dbTop[collection;field;count;(order)]
| Parameter | Description |
|---|---|
collection |
Collection name: lowercase letters, digits, _, . or - (up to 64 characters). It is created on first write. |
field |
Numeric field to rank on. |
count |
How many documents (1 to 100). |
order |
Optional. desc (default, highest first) or asc. |
{"id":...,"data":{...},"rev":...}.$dbTop[players;xp;10]