Delete Many with Limit

Hi @parvathi_nair,

The best way to perform this operation is by fetching the needed for cleanup _id with a query using a limit and than pass it to a bulk delete bulk.find({_id : xxxxx}).remove():

Than execute the batch in 1000 chunks.

Please note that a better cleanup maybe using ttl index on a date field:

Best
Pavel

1 Like