I find Firebase Database sample very helpful, but I noticed something which worries me a little bit.
I mean in this example user can give star to the post, something like "Like it" on Facebook. In provided sample they nested stars into post, so we have sample object like this:
"post_id" : {
"author": "username",
"body": "Some content",
"starCount": 1
"stars" : {
"user_id_who_gave_star" : "true"
}
"title": "Some title",
"uid": "author_id"
}
Such solution has many advantages, like e.g. we can check if have already gave star and hide or change icon, or we can one transaction to change "starCount" and add next value to "stars".
But the problem is when we have big application and 1000 users gave star, so everytime when we download post data we download 1000 userIds which may be not best solution.
Question
My question is, what is best approach for such applications and have someone tested how Firebase works in this situation?