I apologize if this is not the right venue to ask such a question. This is my first time on this site and I'm open to suggestions.

I am trying to find a good schema for a database that needs to record discrete timeslots of availability of a certain item (like an Airbnb room for example) and allows users to search for items that are available on a certain timeslot.

My current solution, on a NoSQL database, is to have a collection of items with certain parameters, of which one is an array of available timeslots.

Example Item:

Item 1
Name: Foo
Location: Miami
[Tues 10am, Tues 11am, Wed 12pm, Wed 1pm....]

From this schema, I would search for items where available_dates contain X or Y slot(s).

Since the potential available times can be quite a few per item, I'm not sure if my current solution is the optimal one. Is there a best practice for something like this, or a suggestion as to how I could structure my database?

  • 1
  • 1
    You might want your site to be up a couple of months before envisaging an Airbnb type infrastructure ( :-) ) - so in the meantime, as you're getting off the ground, you might want to take a look at some of the schemas here (search for "reservation" and "booking"). p.s. @scsimon +1 - nice article. – Vérace May 14 '18 at 17:43
  • Thanks.. updated my question to reflect that I'm more interested in the schema than the infrastructure – Jacobo Koenig May 14 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.