I am trying to delete Older records present in my collection .
I have a collection named \"user_track\" , which consists of data in this format shown below
Mongo has a TTL feature on collections, I think this is a nice solution to such cases:
https://docs.mongodb.com/manual/tutorial/expire-data/
Basically something like:
db.log_events.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 3600 } )