[DOCS-1455] Add Section to Describe "dynamic" TTL collections Created: 29/Apr/13  Updated: 30/Oct/23  Resolved: 12/Aug/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: mongodb-2.4
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Minor - P4
Reporter: Adam Comerford Assignee: Zack Brown
Resolution: Done Votes: 1
Labels: newwriter
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Requires 2.2+ which introduced TTL indexes

This probably belongs as an addendum here:

http://docs.mongodb.org/manual/tutorial/expire-data/


Participants:
Days since reply: 10 years, 26 weeks, 2 days ago

 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.



 Comments   
Comment by auto [ 19/Aug/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1455: edits
Branch: master
https://github.com/mongodb/docs/commit/cbe6e7fa101a65d65036f331489e630b2212d3f2

Comment by auto [ 19/Aug/13 ]

Author:

{u'username': u'Zackrobat', u'name': u'Zack Brown', u'email': u'zack.brown@10gen.com'}

Message: DOCS-1455: Add Section to Describe dynamic TTL collections

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/2e59f50a74dbb356e9c37b93457f57d6379271be

Generated at Thu Feb 08 07:41:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.