TTL Indexes not working in mongod standalone

I’m running mongod in standalone node. 3 years back we had replication and sharding enabled but since that we migrated back to single node. But TTL Index is not working in single node.

I’ve checked whether ttl monitor is enabled
db.adminCommand( { getParameter: 1, ttlMonitorEnabled: 1 } )
{
“ttlMonitorEnabled” : true,
“ok” : 1
}

but on doing this
db.serverStatus().metrics.ttl
{
“collSubpassesIncreasedPriority” : 0,
“deletedDocuments” : 0,
“passes” : 0,
“subPasses” : 0
}

Deleted documents count is zero even though I have ttl Index.

I have also deleted documents in local.system.replset and still ttl Indexes are not effective. What could be the reason.

Hi @manoj_draup

Drop the local datadase. db.getSiblingDB('local').dropDatabase() and restart mongod

When part of a replicaSet is running in standalone mongod runs in kind of a ‘Maintenance Mode’ and the TTLMonitor won’t run. When permanently changing to a standalone drop the local database.

1 Like

Hi @chris , I cleared “system.replset” collection under local database and restarted the server. It worked for me. Thank you.

1 Like