title: Sum of values in Nested Json Array objects via MongoDB Query
body: <p>Wanted to find the sum of Nested json array via mongodb query:</p>
  <p>$group is asking for _id for grouping each obj in array, which is not working.</p>
  <p>The documents is like this :</p>
  <pre><code>{
   point : &quot;3&quot;,
   created_date : &quot;2022-06-19&quot;,
   &quot;name&quot; : &quot;grpA&quot;,
   &quot;value_format&quot; : [
   {
      &quot;data&quot; : {
          &quot;A&quot; : 10,
          &quot;B&quot; : 20,
          &quot;C&quot; : 30,
          &quot;D&quot; : 40,
       },
       &quot;key&quot; : &quot;key1&quot;
    },
       &quot;data&quot; : {
          &quot;A&quot; : 50,
          &quot;B&quot; : 60,
          &quot;C&quot; : 70,
          &quot;D&quot; : 80,
       },
       &quot;key&quot; : &quot;key2&quot;
    }
  ]
  }
  
  
  Expected output : 
  
  {
    &quot;key&quot; : &quot;anything&quot;,
    &quot;val&quot; : {
               &quot;sumA&quot;: 60,
               &quot;sumB&quot;: 80,
               &quot;sumC&quot;: 100,
               &quot;sumD&quot;: 120,
            }
  }
  </code></pre>