title: Adding a created date field from _id to all mongo documents
body: <p>I am trying to add a new field <code>createdDate</code> to all existing documents using <code>_id</code> field. I am doing this for easy readability of the documents. I tried following snippet but it is not working.</p>
  <pre><code>dbase.collection(&quot;cname&quot;).updateMany(
    {},
    { $set: { createdDate: new Date(parseInt(&quot;$_id&quot;.substring(0, 8), 16) * 1000) } } 
  )
  .then((resp)=&gt;{ console.log('complete') })
  </code></pre>
  <p>This is the <code>createdDate</code> for all my documents now (after running the query): &quot;1970-01-01T00:00:00.000+00:00&quot;</p>
  <p>What is wrong with my code ?</p>