In my data structure I a Master elements that contain children Detail elements (one-to-many), something like that:
/myapp/masters/1234/details/5678
/myapp/masters/1234/details/3456
/myapp/masters/6789/details/9876
Now when I display a list of masters in a table view in my ios app, I would like to display the number of children under each master element:
- 1234 (2)
- 6789 (1)
What is the best way to do that efficiently with Firebase? Should I keep a counter inside the element stored at the master level and update it transactionally every time a new detail is appended to it? Other strategy?