I am using firebase in my android application and my tree looks like this
data > tanks > username1 > kills = 1, tries = 3
> username5 > kills = 5, tries = 13
> username7 > kills = 3, tries = 7
> username2 > kills = 6, tries = 4
data > cannons > username9 > kills = 31, tries = 33
> username7 > kills = 15, tries = 13
> username3 > kills = 13, tries = 77
> username6 > kills = 66, tries = 44
what i am trying to do is show the user the top 10 usernames with the highest kills for cannons or tanks (depending on which one the user selects) but i cant seem to find a solution.
At first i thought the solution would be like
ref.child("data/tanks").orderbyChild("kills")
but it doesn't seem to work the problem is that it doesn't return the "kills" child. it returns the whole tree of the tank which i can already access. What i want is to get a list of all "kills" child if that's possible? And i am not sure how else can i get the highest kills because there's no way of knowing which of the usernames are in tanks or cannons unless i iterate through all of the usernames.
Can anyone help me with this?