Database
[{"collection":"docs","count":100,"content":{"callDataDate":{"type":"date","startDate":"2023-01-01T00:00:00Z","endDate":"2024-04-17T00:00:00Z"}},"indexes":[]}]
Query
db.docs.aggregate([{"$match":{"$expr":{"$gt":[{"$dateDiff":{"startDate":"$callDataDate","endDate":"$$NOW","unit":"day"}},90]}/** ...your other criteria here*/}},{"$setWindowFields":{"sortBy":{"_id":1},"output":{"deleteBatch":{"$documentNumber":{}}}}},{"$set":{"shouldDelete":true,"deleteBatch":{"$mod":["$deleteBatch",10]}}},{"$merge":{"into":"docs","on":"_id"}}])