The index date_created_-1 does not delete old documents (older than 864000 seconds). We have tried dropping and recreating this index. Our MongoDB version is 6, and we upgraded this cluster from version 4.4. Since the upgrade, we have encountered this issue. The size of the collection has increased to 1.5TB.
How can we fix this? Could it be related to the upgrade? This issue did not occur in our other clusters.
TTL indexes are very slow on descending order indexes in MongoDB versions before 7.0
Upgrade to MongoDB 7.0 (or 8.0) or recreate the the TTL index in ascending order.
It is also possible something else is wrong, review the log file for errors relating to TTL index.
The progress of TTLMonitor can be observed via db.serverStatus().metrics.ttl the deleted documents. Passes should increase regularly, every minute or so.
Check the mongod log for anything relating to TTL.
A couple of other things to check:
TTL Monitor has been disabled. Check the mongod.conf(or command line parameters) for setParameter and TTLMonitorEnabled: false or db.adminCommand({getParameter:1,ttlMonitorEnabled:1})
If this host was previously part of a replicaSet and is subsequently running in standalone then the TTLMonitor will be disabled, this is a logged condition. If this is the case and the host will remain a standalone the drop the local database and restart mongodb db.getSiblingDB('local').dropDatabase()