title: How can we sum the counts of certain groups in mongodb?
body: <p>I have the collection in which I am able to find out the counts of individual group but I want also sum some certain groups count to each other.</p>
  <pre><code>{ &quot;_id&quot; : ObjectId(&quot;1&quot;), &quot;loginID&quot; : Ram.1234@gmail.com , &quot;name&quot; :Ram, opertion:modified }
  { &quot;_id&quot; : ObjectId(&quot;2&quot;), &quot;loginID&quot; : Arjun34@gmail.com, &quot;name&quot; :  Arjun, opertion:updated }
  { &quot;_id&quot; : ObjectId(&quot;3&quot;), &quot;loginID&quot; :Ram.1234@gmail.com , &quot;name&quot; : Ram,opertion:modified_ext }
  { &quot;_id&quot; : ObjectId(&quot;4&quot;), &quot;loginID&quot; : Arjun34@gmail.com, &quot;name&quot; : Arjun,opertion:updated }
  { &quot;_id&quot; : ObjectId(&quot;5&quot;), &quot;loginID&quot; : Arjun34@gmail.com, &quot;name&quot; : Arjun,opertion:read}
  { &quot;_id&quot; : ObjectId(&quot;6&quot;), &quot;loginID&quot; : shyam78@gmail.com, &quot;name&quot; : Shyam,opertion:deleted }
  { &quot;_id&quot; : ObjectId(&quot;7&quot;), &quot;loginID&quot; : shyam78@gmail.com, &quot;name&quot; : Shyam,opertion:updated_file}
  { &quot;_id&quot; : ObjectId(&quot;8&quot;), &quot;loginID&quot; : Arjun34@gmail.com, &quot;name&quot; : Arjun,opertion:read  },
  { &quot;_id&quot; : ObjectId(&quot;9&quot;), &quot;loginID&quot; :Ram.1234@gmail.com , &quot;name&quot; : Ram,opertion:modified_txt },
  { &quot;_id&quot; : ObjectId(&quot;10&quot;), &quot;loginID&quot; :Ram.1234@gmail.com , &quot;name&quot; : Ram,opertion:modified }
  </code></pre>
  <p>I am able to get the individual opertion count:-</p>
  <pre><code>{
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;modified&quot;
      },
      &quot;total_document&quot; : 2
  }
  
  
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;modified_txt&quot;
      },
      &quot;total_document&quot; : 1
  }
  
  
  
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;modified_ext&quot;
      },
      &quot;total_document&quot; : 1
  }
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;updated&quot;
      },
      &quot;total_document&quot; : 1
  }
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;updated_file&quot;
      },
      &quot;total_document&quot; : 1
  }
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;read&quot;
      },
      &quot;total_document&quot; : 2
  }
  </code></pre>
  <p>// but I want sum of some operations together.</p>
  <p>modified=modified+modified_txt+modified_ext
  similarly updated=updated+updated file</p>
  <pre><code>{
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;modified&quot;
      },
      &quot;total_document&quot; : 4
  }
  
  
  
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;updated&quot;
      },
      &quot;total_document&quot; : 2
  }
  
  {
      &quot;_id&quot; : {
          &quot;operation&quot; : &quot;read&quot;
      },
      &quot;total_document&quot; : 2
  }
  </code></pre>