Leonardo Guerberg
06/14/2023, 4:11 PMJason Bosco
06/14/2023, 4:47 PMbookings
collection that has records like this:
{
"house_id": 1,
"booking_id": 1,
"booking_starts_at": 12345567,
"booking_ends_at": 12348999
}
{
"house_id": 1,
"booking_id": 2,
"booking_starts_at": 12349322,
"booking_ends_at": 12350021
}
{
"house_id": 2,
"booking_id": 3,
"booking_starts_at": 12349322,
"booking_ends_at": 12350021
}
And another houses
collection that looks like this:
{
"house_id": 1,
"bed_rooms": 3,
"pool": true,
"parking_spots": 2
}
You’d first do a query to the bookings
collection to get all booking records within the user selected time range.
Then take the unique house_ids from the above query, and do another query to the houses
collection to say get me all houses that don’t have a house_id from the above query, but match the other amenities filter the user might have selectedLeonardo Guerberg
06/14/2023, 5:06 PM