Join two tables from Firebase

Database & APIs

Hello! I've had trouble filtering Firestore queries by information from another table.

For the sake of the example, I want to design an app where a user can:

  1. Search restaurants by location (<- this one is done โœ…)

  2. Search restaurants where no reservation where made at a specific time (<- my trouble)

Here how I've structured the project:

  • I have on table called Places with information about restaurants (id, name, latlng, stars google, etc.)

  • I have a table called Bookings with information about bookings. The table the following columns:

    • id -> unique Id

    • placeId -> Document Reference to the Places table

    • date -> Date (date + hour of the booking)

What I want to do is to :

  • Filter the restaurants by selection * places from the Places table where location is == to the user's input (request #1)

  • Take this request, a look into the Bookings table if the items from request #1 have a booking in the table

  • Return the request #1 without the restaurants with a booking

=> Any idea how to properly do this? :-)

What have you tried so far?

I tried different things:

  1. Query every location with the "onload" action and then filter it in a ListView with the ListView querying the Bookings table and try to hack a "Filter with Item in Bookings table" --> doesn't work

  2. Use the subcollection feature -> can't add things into the subcollection (as not supported by Flutterflow right now) and can't figure out how to use a proper filtering

Did you check FlutterFlow's Documentation for this topic?
Yes
6 replies