Skip to content Skip to sidebar Skip to footer

How Do I Load/retrieve A Many To Many Relationship In Firebase Realtime Database

In my Android project I need Firebase to load/retrieve my list of 'children' (user with name) when retrieving an object (group) that is in a Many-to-Many relationship, like the str

Solution 1:

It is more common to have four top-level lists for this scenario: groups, users, groupUsers, and userGroups. This allows you to load precisely what you need, at the cost at some extra code. See Many to Many relationship in Firebase.

If you're worried about problems, it may help to know that all requests go over a single connection, so it's quite unlikely that one succeeds and other fails. Chances of one failing due to connection problems are no bigger with multiple calls than they'd be with a singe call. See Speed up fetching posts for my social network app by using query instead of observing a single event repeatedly


Post a Comment for "How Do I Load/retrieve A Many To Many Relationship In Firebase Realtime Database"