Mongodb find created results by date today
Your start date object should hold the current date time hours at 00:00:00.000 (milliseconds precision) and set the hours for today’s date to 23:59:59.999: var start = new Date(); start.setHours(0,0,0,0); var end = new Date(); end.setHours(23,59,59,999); Then pass the modified date objects as usual in your MongoDB query operator: db.posts.find({created_on: {$gte: start, $lt: end}}); If … Read more