0

I am attempting to search for all users who are a part of a given club/organization. I would have both the clubsOrgsId and clubsOrgsName. In the list of users these two data points are in an object named by the clubsOrgsId in a list called clubsOrgs, as seen below. Is this possible to do with a Firebase query; I would rather not run the search locally.

Layout of Database

This app is being written in Kotlin but an answer is appreciated regardless of programming language.

mail929
  • 2,768
  • 3
  • 15
  • 12

1 Answers1

2

Your current data structure allows your to efficiently find the club orgs for a given user. It does not allow you to efficiently find the users for a given club org. If you want that, consider adding an inverted data structure to allow it:

CLUBORGS
  $cluborgid
    users
      $uid: true

With this additional structure in place, the lookups are super easy.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807