Querying by date, regardless time part Querying by date, regardless time part mongoose mongoose

Querying by date, regardless time part


As per this post;

How do I resolve a year/month/day date to a more specific date with time data in MongoDB?

you can store the data separately (as well as the full date) in your schema for easier searching. You could also do this;

Post.find({Posted:{$gt: Date("2012-10-01"), $lt:Date("2012-10-02")}})

(updated to use Date() rather than ISODate() for better compatibility)