TTL not working with 4.4.6

I used exact same commands mentioned in below link (expire documents at specific time clocks)

I did

db.log_events.createIndex( { "expireAt": 1 }, { expireAfterSeconds: 0 } )

and then

    db.log_events.insert( {    
       "expireAt": new Date('July 22, 2013 14:00:00'),    
       "logEvent": 2,    
       "logMessage": "Success!"    
    } )    

I tested above commands with 4.4.6 and 4.0.5. It works correctly with 4.0.5 and documents are deleted automatically after expiry time but it doesn’t work with 4.4.6.

getIndex output from 4.4.6

[ { v: 2, key: { _id: 1 }, name: '_id_' },
  { v: 2,
    key: { expireAt: 1 },
    name: 'expireAt_1',
    expireAfterSeconds: 0 } ]

getIndex output from 4.0.5

[ { v: 2,
    key: { _id: 1 },
    name: '_id_',
    ns: 'tabletBankingDB.log_events' },
  { v: 2,
    key: { expireAt: 1 },
    name: 'expireAt_1',
    ns: 'tabletBankingDB.log_events',
    expireAfterSeconds: 0 } ]

I tried creating index manually as well and saw same results i.e it is working with 4.0.5 but not with 4.4.6.

When you say it doesn’t work, what do you mean?

After a few minutes you still see the document exists in 4.4.6 and hasn’t been deleted?

Asya

Yes, Document still remains in the database. I’m sorry am not the creator of the thread but I am facing the same issue, Need your help

If you provide the TTL index you have and sample document that should be deleted and isn’t, we might be able to see what’s wrong.