title: How to update date field to a specific date format value in mongoDB compass?
body: <p>My MongoDB compass document looks like this</p>
  <pre><code>{
    &quot;_id&quot;: &quot;123456789&quot;,
    &quot;code&quot;: &quot;x123&quot;,
    &quot;title&quot;: &quot;cool&quot;,
    &quot;createdDate&quot;:2022-07-06T08:04:52.156+00:00
    &quot;expiryDate&quot;:2023-12-31T00:00:00.000+00:00
  }
  </code></pre>
  <p>I tried to create a mongo DB script in my pipeline to update the <code>&quot;expirydate&quot;</code> field to a specific date value <code>&quot;9999-12-31T00:00:00.000Z&quot;</code> format. My update script looks like this as I am trying to update it via my pipeline. The <code>createdDate</code> field took the current date correctly.</p>
  <pre><code>{
    &quot;command&quot;: &quot;updateOne&quot;,
    &quot;datasource_name&quot;: &quot;Austrailia&quot;,
    &quot;collection_name&quot;: &quot;Sydney&quot;,
    &quot;query&quot;: {
      &quot;code&quot;: &quot;x123&quot;
    },
    &quot;options&quot;: {
      &quot;upsert&quot;: true,
    },
    &quot;update&quot;: {
      &quot;$currentDate&quot;: {
        &quot;createdDate&quot;: {
          &quot;$type&quot;: &quot;date&quot;
        }
      },
      &quot;$set&quot;: {
        &quot;title&quot;: &quot;hot&quot;,
        &quot;expiryDate&quot;: {
         &quot;$date&quot;: &quot;9999-12-31T00:00:00.000&quot;
        }
      }
    }
  }
  </code></pre>
  <p>The script is failing as it is throwing errors -</p>
  <pre><code>{MongoError: Unknown modifier: expiryDate. Expected a valid modifier}
  The dollar ($) prefixed field \'$date\' in \'expiryDate.$date\' is not valid for storage. 
  </code></pre>
  <p>What would be the correct query syntax to update the date field <code>&quot;expiryDate&quot;</code> to the value specified above in the same format here?</p>