I want to make leaderboard by country. I tried such query:
.orderByChild(COUNTRY_COLUMN)
.equalTo(country)
.orderByChild(TROPHIES_COLUMN)
But Firebase don't allow combine multiple orderBy calls. How can I make such query?
I want to make leaderboard by country. I tried such query:
.orderByChild(COUNTRY_COLUMN)
.equalTo(country)
.orderByChild(TROPHIES_COLUMN)
But Firebase don't allow combine multiple orderBy calls. How can I make such query?
There are multiple methods to achieve this, one is to filter by country and then on the client order by trhopies, you can also create another column in firebase that would be the index, something like:
country_trophies_index: 'US_12'
and then just do the orderby that property.
You can see more details in this answer: