Online Archive Using _id?

I want to create an online archive for a collection. I would like this to be date based, archiving any documents older than 14 days. However, the only date field in the document is _id (an object id). It does not seem like online archive supports using _id as the date field?

Any suggestions on how I could do this?

Hello @Sean_Daniels ,

Yes, with Online Archive, you cannot use _id as the date field.

Technically, you can incorporate the workaround of using the $expr in custom criteria of Online Archive. The custom query will likely not be using an index and the archival process itself will be likely slow. We have mentioned below in our documentation :

For custom criteria that use an expression, Atlas might first convert a value before it evaluates it against the query.

The recommendation is that you create a new indexed date field. This is the right approach that will optimize/improve the archiving speed.

We wouldn’t recommend custom criteria and using $expr and using _id due to the slowness mentioned above.