So I have a sports app, which handle matches and championships data. I have two displays using the same data:
- All future matches
- All future matches from a certain championship
The data is structured like this
- championships
- libertadores
- name: Libertadores da América
- matches
- 2j6g42kjhg62
- champ: libertadores
- time: 1433962855
- <data> //teams, scores, stadium and so on
Now, showing future matches is easy:
matchesRef.queryOrderedByChild("time").queryStartingAtValue(currentTimestamp)
.queryLimitedToFirst(20)
.observeEventType(.ChildAdded, withBlock: { (snapshot) in
// code
})
However, because you can't use multiple queryOrderedByChild
I'm stuck at combining this with filtering from championships.
I've thought about changing my data structure to support something like /championship/matches/<matchID>
but that would give me a hard time showing all future matches.
Not filter is not an option here, so how can I accomplish the desired result?