Online archival to delete documents

I’m doing online archival from Atlas mongoDB using custom criteria. As per my requirement I’ve to change the query and conditions as my collection hold different schema of documents. I’d like to understand how the archived data will be deleted after certain days (for example 365 days) as I might have update the different custom criteria query.
Could you please explain more on this topic?

Hey @Veera_Kumar1,

Welcome to the MongoDB Community Forums! :leaves:

While setting up the online archive, you can specify how many days you want to store data in the online archive and a time window when you want Atlas to run the archiving job. Kindly refer to the documentation to read more about it: Managing an Online Archive
Do note, that as of the time of this message, Atlas Online Archive data expiration is available as a Preview feature. The feature and the corresponding documentation may change at any time during the Preview stage.

Additionally, not related to online archives and if it suits your use case, another option is using TTL Indexes which are special single-field indexes that MongoDB can use to automatically remove documents from a collection after a certain amount of time or at a specific clock time.

Hope this helps. Feel free to reach out for anything else as well.


1 Like

Just to add onto this here @Veera_Kumar1 , I think the key is that the “Data Expiration” feature that deletes data from the archive does not depend on a field inside your documents, it depends on when the data was archived. So the clock starts the second that the data was archived, and it will stay in the archive for the number of days you indicate in the expiration rule based on metadata that we store about when data was archived.


Thanks Benjamin. Yes, this would be helpful.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.