title: Using add operator in set pipeline
body: <p>I m trying to update some record using $add operator and $set</p>
  <p>Example</p>
  <pre><code>[
    {
      &quot;key&quot;: 1,
      &quot;revenue&quot;: 0
    },
    {
      &quot;key&quot;: 2,
      &quot;revenue&quot;: 0
    }
  ]
  </code></pre>
  <p>Query</p>
  <pre><code>db.collection.update({
    &quot;key&quot;: 2
  },
  {
    $set: {
      revenue: {
        $add: [
          &quot;$revenue&quot;,
          7
        ]
      }
    }
  },
  {
    &quot;upsert&quot;: false
  })
  </code></pre>
  <p>What I am trying to do is update revenue on every request to update by summing new value with previous value</p>
  <p>What am i missing</p>
  <p>Output</p>
  <pre><code>{
      &quot;_id&quot;: ObjectId(&quot;5a934e000102030405000001&quot;),
      &quot;key&quot;: 2,
      &quot;revenue&quot;: {
        &quot;$add&quot;: [
          &quot;$revenue&quot;,
          7
        ]
      }
    }
  ]
  </code></pre>