title: MongoDB Aggregate If there is a match, the point should always increase with the new amount
body: <p>If there is a match, the point should always increase with the new amount.</p>
  <p>Thank you</p>
  <p><em>Example</em>: users.point : 0.01 new point: 0.02 new point + users.point &gt;&gt;&gt; users.point = 0.03</p>
  <p><a href="https://www.mongodb.com/docs/manual/reference/operator/update/inc/" rel="nofollow noreferrer">https://www.mongodb.com/docs/manual/reference/operator/update/inc/</a></p>
  <pre><code>   &quot;users&quot; : [ 
          {
              &quot;userID&quot; : &quot;1&quot;,
              &quot;point&quot; : NumberDecimal(&quot;0.01&quot;)
          }
  
      ]
  
      client.db(dbProject).collection(&quot;test&quot;).aggregate([
                          { $match: {'_id': data.id} },
                          { $unwind: '$users' },
                          { $match: { 'users.userID': { $in: [data.userID]} }, },
                          { $project: {
                             _id: 0,
                             point: {
                                   $cond: { if: { $gte: [&quot;$users.point&quot;, 0] },
                                            then: &quot;ok&quot;, else: &quot;no&quot;}
                                   }
                          }}])
  </code></pre>