Follow-up on Firebase Realtime Database Leaderboard Solution :
Hi @Frank, thanks for the answer! 🙏
I was able to solve it by updating the query:
var task = reference.Child("users")
.OrderByChild("levelContainer/highestScore")
.StartAt(currentUserScore, userId)
.GetValueAsync();
What I have achieved :
- Retrieve the top 10 users ordered by
highestScore.
- Retrieve the current user’s rank in the leaderboard (even if they are not in the top 10).
Follow-up Questions :
- Would Firestore be a better choice for this type of use case where I need to query/search over a large list of users?
- I’ve set the rule as you mentioned — but does setting
.indexOn also sort the data in the Firebase console UI? (Because it didn’t appear sorted there.)