Delete collection data older then 3 months

Hi community,

I’ve got a website where people can order stuff.
All the products that are ordered goes to a collection.
for each product the database has around 10 lines of data in the collection.
Is there a way to automaticly delete rows from a collection afther X amount of time(months),

Kind regards,
Kristof

We all use Job Schedulers for that. You run it every day once, select everything that is older than x month and then kill it. One word of warning, though (well, actually, a bit more):

  1. use bulkDelete()
  2. throttle the amount of rows to delete (docs say 1000 max., do not do it. Try 50 at a time, wait for result, if OK, next 50, etc).