Okay I am pretty sure this thing must be a bug... I have to enter the month previous to what I am looking for:
{
"SportId":"Horse Racing",
"Date":{$gt: new Date(2012,11,4)}
}
Explain output:
[ 15:21:39 ]
db.Fixture.find({ "SportId" : "Horse Racing", "Date" : { "$gt" : ISODate("2012-12-04T00:00:00Z") } }).limit(50);
db.Fixture.find({ "SportId" : "Horse Racing", "Date" : { "$gt" : ISODate("2012-12-04T00:00:00Z") } }).limit(50).explain();
Can anyone explain this - better than above? Not essential as now that I know I can work around it. But it seems like a pretty strange thing to happen.
The month is Zero based in the javascript Date constructor.
http://www.w3schools.com/js/js_obj_date.asp
http://www.w3schools.com/jsref/jsref_setmonth.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With