[SERVER-9305] Enabling adding expireAfterSeconds to convert to a TTL index Created: 09/Apr/13 Updated: 06/Dec/22 Resolved: 01/Feb/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Duplicate | Votes: | 10 |
| Labels: | ttl | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Assigned Teams: |
Storage Execution
|
||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
The challenge with this is in the way system.indexes is implemented. It is not possible to easily grow the index spec document. This would allow you to take any existing index and have it work as a TTL index. Should test this also works with _id indexes. |
| Comments |
| Comment by Louis Williams [ 01/Feb/22 ] | ||||
|
Indexes can now be converted to TTL as of We will not support this on _id indexes. | ||||
| Comment by leonn paiva [ 31/May/15 ] | ||||
|
Add TTL on _id would be the best. If you need to have very fast writes in a scenario with a big load of data. | ||||
| Comment by Kevin Pulo [ 10/Oct/14 ] | ||||
|
A possible workaround is to create another index in the reverse order, with TTL, and then once that's built drop the original index. The downside is you need enough space and time to build the index again. ie. instead of trying to "convert" {a:1} to TTL, do something like
If you feel like being clean you could then do
to get back to having the "right" index, even though the reverse one should work just as well. | ||||
| Comment by Ryan Witt [ 21/Oct/13 ] | ||||
|
+1 | ||||
| Comment by Eliot Horowitz (Inactive) [ 05/Jun/13 ] | ||||
|
Its not trivial to add to collmod |