I have a doubt regarding schema design and data modelling
I Want to design a schema for a project related to Reservation where you have to select a date range with time slots and it will return with the available slots in different Lots and you also have more than one spot in a single Lot for your reservation to understand this let’s take a real world scenario…
- A parking lot has 300 or more parking spots
- And each parking spots can be booked for different date/time range
- But if the slot is booked for the future then it means until that time reaches that spot will be available right?
- Now I was thinking about how I can design a schema or what approach I should follow to solve this problem. Also it takes very less time to read and give the result of available spots in different parking lots.
- I am not choosing to store the booking records inside an array because if we do so when we will be searching for available Slots then it has to go to each and every Lot and in each Lot it will loop through each slot for checking whether the slot is available or not.
Actually I am looking for a Scalable and Efficient solution so the users don’t have to wait more to see the result when our database grows.
I am thinking of making a Reservation schema and do child parent referencing with Start and End date with time but when we search for availability how can I do so?
Can anyone help me with this problem?