[SERVER-6701] TTL expiration using _id index Created: 03/Aug/12 Updated: 07/Dec/22 Resolved: 05/Jun/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Storage, Usability |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Kevin Matulef | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 6 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Since the default ObjectIds contain a timestamp, it would be nice if the _id index could also be used as a TTL index. Ideally the user would just attach an {expireAfterSeconds : x}option to their existing _id index, and the TTL monitor would be smart enough to delete old documents based on the timestamp embedded in the ObjectIds. |
| Comments |
| Comment by Dwayne Bull [ 07/Dec/22 ] |
|
I found this after looking into Clustered Collections and their ability to expire on the _id field, this would be really helpful if it could use ObjectId. I looked at the duplicate ticket and it doesnt seem to mention ObjectIds so I wasn't sure if this was still an option. |
| Comment by Daniel Pasette (Inactive) [ 28/Mar/16 ] |
|
jason.coombs@yougov.com, I don't think the linked ticket capture the idea of using ObjectID's for TTL. I thought that there might already be a ticket for this, but I couldn't find one. |
| Comment by Jason R. Coombs [ 28/Mar/16 ] |
|
Does the duplicate ticket effectively capture the aspect that timestamps for ObjectIds be recognized by TTL indexes for the purpose of expiration, or should that be a separate ticket? |
| Comment by leonn paiva [ 31/May/15 ] |
|
+1 , If you need to have very fast writes in a scenario with a big load of data, this would be the best. |
| Comment by Ryan Witt [ 21/Oct/13 ] |
|
+1 |
| Comment by Eliot Horowitz (Inactive) [ 05/Jun/13 ] |
|
|
| Comment by andy [ 27/Feb/13 ] |
|
+1. Ideally, one should be able to set "expireAfterSeconds" on each index to a field that holds ObjectId, timestamp or Date values. |