I've got a collection booking. Inside that Collection i've got for debug one document:
{
"_id": ObjectID("55d7608120b345d2cc7c9f45"),
"name": "booking1",
"start": ISODate("2015-01-10T00:00:00.000Z"),
"end": ISODate("2015-01-20T00:00:00.000Z")}
Now I have a second Date Range and want to check If the Date Range B overlaps in one of the booking documents.
My Query is:
db.booking.find({$or:[{"start":{$gt:ISODate("2015-01-15T00:00:00.000Z")}},{"end":{$lt:ISODate("2015-01-25T00:00:00.000Z")}}]});
When I execute it Sometimes I get a result and When i change the Date in the query I get no result. It's not logic! I don't know if the query is correct or i should change mit tactic.
My App is a Node JS + Express + MongoClient environment.
I hope for answers, Thank you All Greetings DroidSheep