Query Firebase data on multiple reference IDs -
i have data structured below in firebase. there users having list of groups have access to. wonder how make firebase query fetching groups $refids equal once within "groups" section in users. many-to-may relationship. make list of groups user member of.
is option fetch them 1 one or there better solution?
users: { "$uid": { name: "john doe", groups: { "$refid": true, "$refid": true } }, "$uid": { name: "jane doe", groups: { "$refid": true } } }, groups: { "$refid": { title: "group 1" }, "$refid": { title: "group 2" } }
as suggested, loading in groups user node , iterating on each group.
another option different group structure
groups: { "$refid": { title: "group 1" uid0: true uid1: true }, "$refid": { title: "group 2" uid1: true uid3: true } }
you query groups node uid1: true, return groups uid1 part of; group 1 , group 2 in case.
Comments
Post a Comment