title: How to update array of object using node with mongodb and postman?
body: <p>My Object is</p>
  <pre><code>{
  &quot;_id&quot;: &quot;5fc49f48502ed001f437f49b&quot;,
  &quot;students&quot;: [
      {
          &quot;_id&quot;: &quot;5fc49f48502ed001f437f49c&quot;,
          &quot;name&quot;: &quot;John&quot;,
          &quot;class: &quot;5&quot;,
          &quot;age&quot;: &quot;9&quot;
      },
   {
          &quot;_id&quot;: &quot;5fc49f48502ed001f437f49d&quot;,
          &quot;name&quot;: &quot;Richa&quot;,
          &quot;class: &quot;7&quot;,
          &quot;age&quot;: &quot;13&quot;
      }
  ]
  }
  </code></pre>
  <p>My Update Code is:</p>
  <pre><code>router.put(&quot;/:id/:studetid&quot;, async (req, res) =&gt; {
  try {
  const student= await Student.update(
    { &quot;students._id&quot;: req.params.studentid},
    {
      $set: {
        &quot;students.$.name&quot;: req.body.name,
        &quot;students.$.class&quot;: req.body.class,
        &quot;students.$.age&quot;: req.body.age,
      },
    }
  );
  </code></pre>
  <p>When i Select id and Update any value form object, Value updated success but other value which are not update sets to null..</p>
  <pre><code>{
  &quot;_id&quot;: &quot;5fc49f48502ed001f437f49b&quot;,
  &quot;students&quot;: [
      {
          &quot;_id&quot;: &quot;5fc49f48502ed001f437f49c&quot;,
          &quot;name&quot;: null,
          &quot;class: &quot;6&quot;,
          &quot;age&quot;: null
      },
  }
  </code></pre>
  <p>Please Can anyone help me to solve this problem...I want to update data dynamically...I'm using Postman to send data</p>