title: Mongodb plus and minus in one query (subtract two query results)
body: <p>I have the following collection:</p>
  <pre><code>[
  
  {
      &quot;type&quot;: &quot;debit&quot;,
      &quot;amount&quot;: 10
  },
  {
      &quot;type&quot;: &quot;debit&quot;,
      &quot;amount&quot;: 20
  },
  {
      &quot;type&quot;: &quot;credit&quot;,
      &quot;amount&quot;: 5
  },
  ]
  </code></pre>
  <p>I need to sum all documents with type debit and minus sum of credits.</p>
  <p>how can I handle this with mongodb?</p>
  <p>so my expected result is 25</p>