I use spring data mongodb.
I want the records between two dates. The following MongoDB Query works:
db.posts.find({startDate: {$gte: start, $lt: end}
I had to find dates between on field publishedDate and here is how I did it:
publishedDate
Criteria publishedDateCriteria = Criteria .where("publishedDateObject").gte(psDate) .lte(peDate); Query query = new Query(publishedDateCriteria); mongoTemplate.find(query, MyDocumentObject.class));