Details
-
Improvement
-
Resolution: Done
-
Minor - P4
-
mongodb-2.4
-
Requires 2.2+ which introduced TTL indexes
This probably belongs as an addendum here:
http://docs.mongodb.org/manual/tutorial/expire-data/
Description
From the MongoDB Masters - it was noted that you can create "dynamic" TTL collections where the TTL can effectively be defined in the document. You can do this as follows:
Set expireAfterSeconds to 0 and then set the date field (the one used to create the TTL index) to be X seconds (now() + X) in the future. X then effectively becomes the TTL for that document.