I want to limit a query I\'m making to only look in documents that were created in the past 24 hrs.
What is the best way to structure this query? How do I go about
Add createdAt field, index it, then query
createdAt
db.getCollection("COLLECTION_NAME").find({"createdAt":{$gt:new Date(Date.now() - 24*60*60 * 1000)}})
This will return all records older then 86400 seconds.