title: MongoDB TTL does not works
body: <p>I work on debian 10(buster) with mongod ver. 4.2.17. I want to use TTL to remove older documents on collection. I do walk around and I'm sure that no typo on the query.</p>
  <p>I followed dummy example offical mongo on <a href="https://docs.mongodb.com/v4.2/tutorial/expire-data/#field-is-array-of-dates" rel="nofollow noreferrer">this</a> link, where create index on timestamp and expireAfterSeconds.</p>
  <p><code>db.log_events.createIndex( { &quot;createdAt&quot;: 1 }, { expireAfterSeconds: 30 } )</code></p>
  <p>I Also added documents on collection with this</p>
  <pre><code>db.log_events.insert( {
     &quot;createdAt&quot;: new Date(),
     &quot;logEvent&quot;: 2,
     &quot;logMessage&quot;: &quot;Success!&quot;
  } )
  </code></pre>
  <p>but still not work. I do read that the logs not immediately on <a href="https://docs.mongodb.com/manual/core/timeseries/timeseries-automatic-removal/#timing-of-delete-operations" rel="nofollow noreferrer">this</a> but after wait for some hours its still not deleted. Also on mongo logs, there's no TTL log appear. I do checking the indexes with <code>db.log_events.getIndexes()</code> and they do appear.</p>
  <p><a href="https://i.stack.imgur.com/GcLOq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GcLOq.png" alt="enter image description here" /></a></p>
  <p>Any suggestion how to solve it?</p>