Date range query for past 24 hour in Mongo shell
Found answer here: https://stackoverflow.com/questions/1296358/subtract-days-from-a-date-in-javascript
db.system.profile.find({
"timestamp" : {
$lt: new Date(),
$gte: new Date(new Date().setDate(new Date().getDate()-1))
}
})
db.system.profile.find({
"timestamp" :
{
$gte: new Date(new Date().setHours(00,00,00)) ,
$lt : new Date(new Date().setHours(23,59,59))
}
})