title: Update one object in nested child in mongoose
body: <p>Is there any way to update the child element with id of the child element with _id in the following schema with mongoose .</p>
  <p>The mongo document looks like this.</p>
  <pre><code>{
      &quot;_id&quot; : ObjectId(&quot;62d3fee5ae016e6fdb4b3689&quot;),
      &quot;participents&quot; : [ 
          {
              &quot;this_kills&quot; : 0,
              &quot;this_eliminated&quot; : false,
              &quot;this_score&quot; : 0,
              &quot;this_position&quot; : 0,
              &quot;_id&quot; : ObjectId(&quot;62d1c20e3fbeecbdeb945ad1&quot;),
              &quot;teamName&quot; : &quot;Dagger Gaming&quot;,
              &quot;players&quot; : [ 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.amazonaws.com/Biswas%20Sampad1657913727000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1803fbeecbdeb945a93&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913736000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1883fbeecbdeb945a9f&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913737000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1893fbeecbdeb945aa1&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913738000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c18b3fbeecbdeb945aa3&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }
              ],
              &quot;teamLogo&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Dagger%20Gaming1657913870000.png&quot;,
              &quot;teamLogo_name&quot; : &quot;Dagger Gaming1657913870000.png&quot;,
              &quot;created_at&quot; : ISODate(&quot;2022-07-15T19:37:50.895Z&quot;)
          }, 
          {
              &quot;this_kills&quot; : 0,
              &quot;this_eliminated&quot; : false,
              &quot;this_score&quot; : 0,
              &quot;this_position&quot; : 0,
              &quot;_id&quot; : ObjectId(&quot;62d1c2123fbeecbdeb945ad3&quot;),
              &quot;teamName&quot; : &quot;Dagger Gaming&quot;,
              &quot;players&quot; : [ 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913729000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1823fbeecbdeb945a95&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913731000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1833fbeecbdeb945a97&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913732000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1853fbeecbdeb945a99&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }, 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Biswas%20Sampad1657913733000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1863fbeecbdeb945a9b&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : true
                  }
              ],
              &quot;teamLogo&quot; : &quot;https://ruprod-dev.s3.ap-south-1.amazonaws.com/Dagger%20Gaming1657913874000.png&quot;,
              &quot;teamLogo_name&quot; : &quot;Dagger Gaming1657913874000.png&quot;,
              &quot;created_at&quot; : ISODate(&quot;2022-07-15T19:37:54.740Z&quot;)
          }
      ],
      &quot;created_at&quot; : ISODate(&quot;2022-07-17T12:21:57.886Z&quot;),
      &quot;__v&quot; : 0
  }
  </code></pre>
  <p>I am trying to update the following document with this query</p>
  <pre><code>Scoreboard.findByIdAndUpdate(
          boardId,
          {
            $set: {
              &quot;participents.$[t].players.$[p].alive&quot;: false,
            },
          },
          { arrayFilters: [{ &quot;t._id&quot;: teamId }, { &quot;p.id&quot;: playerId }] }
        )
  </code></pre>
  <p>and the query should update the player object with alive :false , e.g.</p>
  <pre><code>{
      &quot;_id&quot; : ObjectId(&quot;62d3fee5ae016e6fdb4b3689&quot;),
      &quot;participents&quot; : [ 
          {
              &quot;this_kills&quot; : 0,
              &quot;this_eliminated&quot; : false,
              &quot;this_score&quot; : 0,
              &quot;this_position&quot; : 0,
              &quot;_id&quot; : ObjectId(&quot;62d1c20e3fbeecbdeb945ad1&quot;),
              &quot;teamName&quot; : &quot;Dagger Gaming&quot;,
              &quot;players&quot; : [ 
                  {
                      &quot;playerName&quot; : &quot;Biswas Sampad&quot;,
                      &quot;playerCallSign&quot; : &quot;buntysama&quot;,
                      &quot;playerImage&quot; : &quot;https://ruprod-dev.s3.amazonaws.com/Biswas%20Sampad1657913727000.png&quot;,
                      &quot;id&quot; : ObjectId(&quot;62d1c1803fbeecbdeb945a93&quot;),
                      &quot;kills&quot; : 0,
                      &quot;granades&quot; : 0,
                      &quot;playerScore&quot; : 0,
                      &quot;totalScore&quot; : 0,
                      &quot;matches&quot; : 0,
                      &quot;kdratio&quot; : 0,
                      &quot;alive&quot; : false
                  }, 
  </code></pre>
  <p>any help would be helpful.</p>