Welcome to the MongoDB Community Forums @Phonon_Infrastructur!
You can use shell/programming scripts to interact with your MongoDB deployment or environment.
To help understand your use case, please share more details about:
- the current manual data purging process that you would like to automate.
- your O/S and MongoDB server versions
- any automation/orchestration tooling you would be using to automate tasks (if applicable)
TTL indexes do not do anything special in terms of document removal: expired documents are removed from the primary and those deletions replicate to secondaries via the oplog.
Your backup strategy would remain the same: choose a supported backup method and schedule that meets your requirements for disaster recovery considerations like Recovery Point Objective (RPO), Recovery Time Objective (RTO), performance impact, etc.
TTL indexes are based on an indexed date field. The TTL background thread runs every 60 seconds and removes all documents with an indexed value that is older than the TTL index
Any documents matching the TTL expiry will be removed, even if they were created before the TTL index.