Hi @Anurag_Singh1,
There are two was to use TTL indexes:
-
Expire documents at a specific clock time (a per-document expiry)
In the latter case you set the TTL expireAfterSeconds value to 0, for example:
db.log_events.createIndex( { "expireAt": 1 }, { expireAfterSeconds: 0 } )
You can update the TTL date value in a document to extend or reduce the per-document expiry time. Documents that do not have a valid Date value will not expire.
NOTE: The background task that removes expired documents runs every 60 seconds, so expired documents will remain in a collection until the background task removes them.
Regards,
Stennie