Remove items from collection if older than 10 minutes don't work?


#1

I would like to remove items from collection if older than 10 mins, 6 months etc
But it seems to remove after 1 min or so, no matter 5 or 10 mins,

if ((moment(details.end_date).startOf('minute')).isBefore(moment().startOf('minute'))) {
   var removeTask = FutureTasks.remove({
       end_date: {$lt: moment().add(10, 'minutes').format("YYYY-MM-DD HH:mm:ss")},
                        });
}

#2

Let the database engine do the hard work.