[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: |
||
| 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: |
| Comment by auto [ 19/Aug/13 ] |
|
Author: {u'username': u'Zackrobat', u'name': u'Zack Brown', u'email': u'zack.brown@10gen.com'}Message: Signed-off-by: Sam Kleinman <samk@10gen.com> |