0

I built my Firebase database as flat as possible.

This is my structure: https://stackoverflow.com/a/40115527/3669981 with a little adjustment: Instead of role values in my projectsRoles node I'm using the role keys assigned to the /roles node (So I can add and edit roles easier).

The pain starts when I need to make 1 + (numUsers*2) Calls in order to get a project member list, assuming I already have the project ID.

  1. Call to projectsRoles/$projectID to get all user IDS of the current project.
  2. Loop each USER ID+Role ID received:
    • Get the role name by roles/$roleID
    • get user information by users/$userID

That means if a project will have 30 members, the app will make 61 calls to firebase database.

My question is: Although the number of calls is high, the data received each call is minimal. I followed the instruction to make is as flat as possible, But is it common to make so much calls to firebase?

Community
  • 1
  • 1
Elikos
  • 103
  • 1
  • 10
  • Yes, it is quite common to make multiple calls to the database. Unlike what you expect, the number of calls is only minimally affected by the number of calls. See http://stackoverflow.com/questions/35931526/speed-up-fetching-posts-for-my-social-network-app-by-using-query-instead-of-obse/35932786#35932786 – Frank van Puffelen Oct 20 '16 at 14:02
  • Glad to hear that! Good to know about your answer there. thank you. – Elikos Oct 20 '16 at 14:44

0 Answers0