Reputation: 11100
I have a query that works like a champ through the Javascript shell...
db.profiles.find(
{ "createdOn" :
{ $gte : ISODate( '2013-04-01T00:00:00.000Z' ),
$lt : ISODate( '2013-04-02T00:00:00.000Z' )
}
}
)
. How do I do this through the Java driver?
Upvotes: 0
Views: 1991
Reputation: 328568
Have you tried something like:
DBObject condition = new BasicDBObject(2);
condition.put("$gte", startDate);
condition.put("$lt", endDate);
Iterable<DBObject> result = collection.find(new BasicDBObject("createdOn", condition));
Upvotes: 1