Is it possible to convert a TTL index into a normal index without dropping and readding it

113 views
Skip to first unread message

John Smith

unread,
Aug 8, 2016, 3:41:49 PM8/8/16
to mongodb-user
We have starting ingesting data into a collection with a TTL index and have changed our minds regarding the automatic purge.  Is it possible to convert a TTL index into a normal index without dropping the index and re-adding it?  

I am considering the obvious work around of updating expireAfterSeconds to a really large value, but I want to consider all possibilities before making a decision.

Thanks,

John

John Murphy

unread,
Aug 15, 2016, 12:18:29 AM8/15/16
to mongodb-user

Hi John,

It is not possible to convert a TTL index into a normal index. Once the expireAfterSeconds setting is configured it cannot be removed. You would need to recreate the index to achieve your desired outcome.

Also as you may be aware, MongoDB has the ability to completely turn off the TTL monitor thread which may yield a slight performance improvement if you do not intend on using any TTL indexes.

Regards,

John Murphy

Reply all
Reply to author
Forward
0 new messages