I'm making an app using React Native and Firebase as a backend. In my app, there are user groups, and I want users to be able to add other users to their group by entering their email addresses. I have my data structured like this: My database
I am indexing users by the uid generated by Firebase authentication so that I can easily get information about the current user. I am indexing groups by a unique ID I generate, and listing the memebers of the group by email (it is currently their name in the table but it will be their email.)
My question is this: eventually I will need to get data about each member from the user table (so I can display their name, etc.) How can I do this? Can I iterate over the entire "users" table trying to find that email address and return the user that has it? Does this data structure make sense?
Thanks!