Booking or reservations system with room availability design

Hello guys,

I’m new to Parse and coming I’m from Firebase. I have question on trying to implement booking/reservation system using Parse Server. I define room object and relation to booking object which have from and to dates. Can you help me with some guidelines or ideas for efficient search for availability of rooms?

My goal is to search for available rooms within date range.
Can this be achieved only with the query APIs? What about the MongoDB indexes in such scenario?


Using the JS SDK, you can do something like this:

const query = room.relation('reservations').query();
query.greaterThanOrEqualTo('to', from);
query.lessThanOrEqualTo('from', to);
const count = await query.count();
if (count == 0) {
  // it is available

You can learn about relation queries here:

1 Like