title: Need to change one element from a document. - MongoDB
body: <p>I'm trying to follow the documentation on mongoDB to change one element from an array, inside an array, inside an array. </p>
  
  <p>This is my element</p>
  
  <pre><code>secciones: [
    {
      _id: ObjectId("5c6ee5d5e12e25dc1ab99b3e"),
      subSeccion: [
        {
          _id: ObjectId("5c6ee5d5e12e25dc1ab99b3f"),
          subSeccionItems: [
            "The witch jumps over the sleepy dog",
            "The witch jumps over the sleepy dog",
            "The dog eats"
            "The cat scratches"
          ]
        }
      ]
    }
  ]
  </code></pre>
  
  <p>The problem is that with this command it changes both occurrences of `The witch jumps over the sleepy dog, and I need just one to be changed:</p>
  
  <pre><code>db.pautas.updateOne({_id:ObjectId("5c6ee5d5e12e25dc1ab99b37")}, {$set: {"criterios.secciones.$[id].subSeccion.$[id2].subSeccionItems.$[enun]": "The witch jumps over the sleepy dog"}}, { arrayFilters: [ { "id._id": ObjectId("5c6ee5d5e12e25dc1ab99b3e")}, {"id2._id": ObjectId("5c6ee5d5e12e25dc1ab99b3f")}, {"enun": "The elephant smells"}]})
  </code></pre>
  
  <p>Same command unformatted:</p>
  
  <p>db.pautas.updateOne({_id:ObjectId("5c6ee5d5e12e25dc1ab99b37")}, {$set: {"criterios.secciones.$[id].subSeccion.$[id2].subSeccionItems.$[enun]": "The witch jumps of the sleepy dog"}}, { arrayFilters: [ { "id._id": ObjectId("5c6ee5d5e12e25dc1ab99b3e")}, {"id2._id": ObjectId("5c6ee5d5e12e25dc1ab99b3f")}, {"enun": "The elephant smells"}]})</p>
  
  <p>Im using this documentation: <a href="https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/" rel="nofollow noreferrer">https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/</a></p>
  
  <p><strong>The command works, but changes both elements, I need just one to change</strong>.</p>
  
  <p>Regards.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Now with the answer from @willis I tried this query and got the same result. I saved some characters but didn't get the result I need, which is to change just <strong>one</strong> occurrence of the item in question.</p>
  
  <pre><code>db.pautas.updateOne({_id:ObjectId("5c6ee5d5e12e25dc1ab99b37")}, {$set: {"criterios.secciones.$[].subSeccion.$[].subSeccionItems.$[enun]": "The witch jumps of the sleepy dog"}}, { arrayFilters: [ {"enun": "The elephant smells"}]})
  </code></pre>
  
  <p>Unformatted:</p>
  
  <p>db.pautas.updateOne({_id:ObjectId("5c6ee5d5e12e25dc1ab99b37")}, {$set: {"criterios.secciones.$[].subSeccion.$[].subSeccionItems.$[enun]": "The witch jumps of the sleepy dog"}}, { arrayFilters: [ {"enun": "The elephant smells"}]})</p>
  
  <p>I'm still stuck here, please help.</p>