given startTime is 3:00 AM given endTime is 5:00 AM
// 3am |----------------------------| 5am
///these four conditions should be not matched, these four comes partially in the given range,
// 3:30am |-------------| 4:30am
// 2am|---------------|4am
// 3:45am|----------------------|6am
// 1am|-------------------------------------------------|7am
previously what I have done is,
"starttime": {"$gte": starttime, "$lte": endtime},
"endtime": {"$gte": starttime, "$lte": endtime},
in mongo query to find check existing slots. if query gives result then i don't insert slot and give response that slot not available.