Hi I want to query MONGO using java.
I have a query like below:
db.flights.find({"timestamp" : {"$lte": new Date("2014-09-05T00:00:00.001Z")}}).count()
Which gives output as 68
When I try to get using java code like below:
table = db.getCollection("flights");
DBObject match = new BasicDBObject();
Date endDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2014-09-05T00:00:00.001Z");
match.put("timestamp", new BasicDBObject("$lte", endDate));
int count=table.find(match).count();
System.out.println(collections+" "+"COUNT : "+count);
The output is 48.
Can anybody tell me the issue in code ??