title: How to convert BSON Timestamp from Mongo changestream to a date?
body: <p>I am getting started with the Changestream in Mongo. In my current setup a stitch functions inserts the changelog events into a revision collection. However when I read data from the collection, I can't convert the Timestamp fields. I have tried with the following 2 attempts:</p>
  
  <p><strong>1) A pipeline</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>[
      {
          $match: {
              'documentKey._id': _id,
          },
      },
      {
          $sort: { _id: -1 },
      },
      {
          $addFields: {
              convertedDate: { $toDate: 'clusterTime' },
          },
      },
  ]
  </code></pre>
  
  <p>But it gives the error: <code>Error parsing date string 'clusterTime'; 0: passing a time zone identifier as part of the string is not allowed 'c'; 6: Double timezone specification 'r'</code></p>
  
  <p><strong>2) The bson Timestamp class</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>import { Timestamp } from 'bson';
  const asTimestampInstance = new Timestamp(v.clusterTime);
  </code></pre>
  
  <p>But here typescript gives me the error: <code>Expected 2 arguments, but got 1.ts(2554)
  index.d.ts(210, 30): An argument for 'high' was not provided.</code></p>
  
  <p>In Altas, the clustertime correctly looks like a timestamp:</p>
  
  <p><a href="https://i.stack.imgur.com/ykG1n.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ykG1n.png" alt="Screenshot of data in Atlas"></a></p>
  
  <p>I hope that I am just missing something simple :) </p>