title: findAndModify conditionally in mongoDB
body: <p>I want to update the <code>promotional</code> value
  if it is greater than the <code>credit</code> I want to set it to <code>30</code>, else I want it to set to <code>20</code>.</p>
  
  <p><strong>Document</strong></p>
  
  <pre><code>    {
          "_id" : "XX",    
          "promotional" : 200,    
  
      }
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>let creditDeduct= 100
  let accountId = 'xx'
  
  this.adapter.collection.findAndModify(
      _id = accountId, 
      [["_id", "asc"]], 
      { "$inc": { $cond: { if: { $gte: [ '$promotional', creditDeduct ] }, then: 30, else: 20 }} },
      { "new": true, "upsert": true }, 
      function(error, doc) { 
          if (doc) {
                  console.log(doc);
                  } 
              if(error){
                  console.log(error);
              }
              }
  );
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>{ MongoError: Cannot increment with non-numeric argument: {$cond: { if: { $gte: [ "$promotional", 100 ] }, then: 30, else: 20 }}
      at Connection.&lt;anonymous&gt; (/xx/xx/node_modules/mongodb/lib/core/connection/pool.js:466:61)
      at Connection.emit (events.js:198:13)
      at processMessage (/xx/xx/node_modules/mongodb/lib/core/connection/connection.js:364:10)
      at Socket.&lt;anonymous&gt; (/xx/xx/node_modules/mongodb/lib/core/connection/connection.js:533:15)
      at Socket.emit (events.js:198:13)
      at addChunk (_stream_readable.js:288:12)
      at readableAddChunk (_stream_readable.js:269:11)
      at Socket.Readable.push (_stream_readable.js:224:10)
      at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)   ok: 0,   errmsg:    'Cannot increment with non-numeric argument: {$cond: { if: { $gte: [ "$promotional", 100 ] }, then: 30, else: 20 }}',   code: 14,   codeName: 'TypeMismatch',   name: 'MongoError',   [Symbol(mongoErrorContextSymbol)]: {} }
  </code></pre>