|
Not sure if this is related, however:
This query produces results:
mongoTemplate
|
.getDb()
|
.getCollection("events")
|
.count(
|
BasicDBObjectBuilder
|
.start(
|
"d",
|
BasicDBObjectBuilder
|
.start()
|
.add("$gte", ISODateTimeFormat.dateTime().parseDateTime("2015-03-19T09:00:00.000-07:00").toDate())
|
.add("$lt", ISODateTimeFormat.dateTime().parseDateTime("2015-03-19T09:00:01.000-07:00").toDate())
|
.get()
|
)
|
.get()
|
);
|
However, this query fails:
mongoTemplate
|
.getDb()
|
.getCollection("events")
|
.count(
|
(DBObject)
|
JSON.parse(
|
"{ \"d\" : { \"$gte\" : { \"$date\" : \"2015-03-19T09:00:00.000-07:00\" }, \"$lt\" : { \"$date\" : \"2015-03-19T09:00:01.000-07:00\" } } }"
|
)
|
);
|
Also this query fails:
mongoTemplate
|
.getDb()
|
.getCollection("events")
|
.count(
|
(DBObject)
|
JSON.parse(
|
"{ \"d\" : { \"$gte\" : { \"$date\" : \"2015-03-19T16:00:00.000+00:00\" }, \"$lt\" : { \"$date\" : \"2015-03-19T16:00:01.000+00:00\" } } }"
|
)
|
);
|
Although all of
2015-03-19T16:00:00.000+00:00
|
2015-03-19T09:00:00.000-07:00
|
Should be equivalent.
To make the broken query work requires the date format with the Z at the end:
This works:
mongoTemplate
|
.getDb()
|
.getCollection("events")
|
.count(
|
(DBObject)
|
JSON.parse(
|
"{ \"d\" : { \"$gte\" : { \"$date\" : \"2015-03-19T16:00:00.000Z\" }, \"$lt\" : { \"$date\" : \"2015-03-19T16:00:01.000Z\" } } }"
|
)
|
);
|
These behaviors were consistent/same between the 3.0.0 rc1 and 2.13.0 drivers.
I believe, queries that fail to return results should be working identically to those that actually return results in this example.
|