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
I have found a solution to address this issue .
var date=new Date();
date.setDate(date.getDate() - 1);
db.user_track.remove({"access_time":{"$lt":date}});
I will make this run automatically by putting these lines in a bash file and scheduling that script using a cron tab .
Please share your views if this is a valid solution or not ??