Let us assume, I have an AirBnb type app. Where users can book houses to stay. Now, I have a database schema for this app, when I find houses for a query, I need to find houses that are available in between 2 dates(given by the user). So that it is not clashing with another booking.
Now, we already have a booking from 18Aug - 20Aug(Below code). If the user is searching for houses and the start/end date is 18/19/20Aug, this property should not be displayed.
Is there anything like NOT BETWEEN in MongoDB, or a workaround so that I can filter the results properly.
{ // This is a snippet of the complete document
"etc": "etc etc etc",
"transaction":
{
"start": "2018-08-18T21:30:00+05:30", // datetime object
"end": "2018-08-20T21:30:00+05:30" // datetime object
},
"etc2": "etc2 etc2"
}
Or If I can design the schema a bit differently?