Hi,
I'm trying to get some data out of a Mongo instance (v 2.4.6) using Java.
I have a date range, which is made of two java.util.Date objects.
I create my query like this:
Query query = new Query(where("myColumn").is(myValue).andOperator(
Criteria.where("myDate").lt(endDate),
Criteria.where("myDate").gt(startDate)));
... but I get no data back, even though I know that there is some which matches the selection criteria in there.
The actual query, extracted from the Query object, looks like this:
{ "myColumn" : "myValue" , "$and" : [ { "myDate" : { "$lt" : { "$date" : "2013-12-31T20:56:05.423Z"}}} , { "myDate" : { "$gt" : { "$date" : "2013-11-30T20:56:05.381Z"}}}]}
If I just search on "myColumn" and remove the date parts, data is brought back which includes "myDate" values inbetween the previously included start and end date search criteria.
Thanks for any assistance.