I am setting a cron job to collect results from MongoDB database profiler. I'd like to collect results within a 24 hrs period. I plan to run mongo command with javascript.
Question is, in Mongo shell, how do I write a query to find a date range from 24 hrs ago? Such as:
db.system.profile.find({
"timestamp" : {
$lte : <current date & time>,
$gt : <date & time 24 hrs ago>
}
})