Reputation: 43
I am making this Quiz android application where I will be storing the record of each user's individual highscore in Cloud FireStore. So I made this collection named users which only has 2 fields- username and highscore. I want to retrieve the username and highscore of the top ten players globally from there to display in the leaderboard. Please let me know how I can do it! Also will it be possible to get the current user's rank?
Upvotes: 2
Views: 1805
Reputation: 598740
As shown in the documentation on ordering and limiting data, you can get the top 10 players with:
usersCollection.orderBy("highscore", Direction.DESCENDING).limit(10);
Upvotes: 3