title: MONGODB update value inside object, inside array, inside collection
body: <p>I have this collection on Mongodb:</p>
  <pre><code>[
    {
      _id: new ObjectId(&quot;630954ebdfec2657ac6086e5&quot;),
      productos: [ [Object], [Object] ],
      timestamp: 2022-08-26T23:19:07.321Z,
      __v: 0
    }
  ]
  </code></pre>
  <p>and i would like to know how can i sum the &quot;cantidad&quot; value inside &quot;productos&quot; array.</p>
  <p>&quot;productos&quot; looks like this:</p>
  <pre><code>[
    {
      nombre: 'sandia',
      foto: 'https://cdn3.iconfinder.com/data/icons/fruits-52/150/icon_fruit_melancia-128.png',
      precio: 12,
      cantidad: 1,
      _id: new ObjectId(&quot;62fc0daf755a14dbac449005&quot;)
    },
    {
      nombre: 'frutillas',
      foto: 'https://cdn3.iconfinder.com/data/icons/fruits-52/150/icon_fruit_morango-128.png',
      precio: 15,
      cantidad: 1,
      _id: new ObjectId(&quot;62fc14badcaffc2a39ab7b46&quot;)
    }
  ]
  </code></pre>
  <p>Any help would be appreciated.</p>
  <p>happy coding!</p>