MongoDB – How to Disable TTL Thread

indexindex-tuningmongodb

Is there any way to disable TTL deletion thread in mongoDB?

I know that you can modify the ttl index expireAfterSeconds value to a high number in order to "technically" stop ttl from deleting, but i am interesting in disabling the ttl thread completely for some time and enable it later.

Thanks in advance

Best Answer

You can use the admin command:

db.adminCommand({setParameter:1, ttlMonitorEnabled:false});

To re-enable, use the same command with true.