lib/mongodb/MongoDBCollection.js
function(update, options, context) {
    var driverOptions = {}
    if (options.upsert) {
      driverOptions = _.assignIn(driverOptions, options.driverOptions, {upsert: true})
    }
    var result = undefined
    try {
      var result =
        this.collection.updateMany(options.query, update, driverOptions)
    } catch (e) {
      // XXX: revisit this when leafnode exposes mongo error codes
      // https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err
      if (!_.isNil(e.code) && e.code === 9) { // FailedToParse
        throw new (this.getService().errors.BadRequest)(e.message)
      }
    }
    var _result = {
      // no matched count here
      val: result.modifiedCount + result.upsertedCount,
      created: result.upsertedCount > 0
    }
    if (_result.created) {
      _result.val = [result.upsertedId]
    }
    return _result
  }
function(update, options, context) {
    var driverOptions = {}
    if (options.upsert) {
      driverOptions = _.assignIn(driverOptions, options.driverOptions, {upsert: true})
    }
    var result = undefined
    try {
      var result =
        this.collection.updateMany(options.query, update, driverOptions)
    } catch (e) {
      // XXX: revisit this when leafnode exposes mongo error codes
      // https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err
      if (!_.isNil(e.code) && e.code === 9) { // FailedToParse
        throw new (this.getService().errors.BadRequest)(e.message)
      }
    }
    var _result = {
      // no matched count here
      val: result.modifiedCount + result.upsertedCount,
      created: result.upsertedCount > 0
    }
    if (_result.created) {
      _result.val = [result.upsertedId]
    }
    return _result
  }
***************************************************************************
@method update
@override
@description Update (or upsert) a number of objects in a collection
@param {Object} update -- The update to be applied to the collection
@param {Object} options -- The operation parameters (see:
{@link carbond.mongodb.MongoDBCollection.UpdateConfigClass})
@param {Object} context -- A free form object to pass data between hook and handler
methods
@returns {typedef:carbond.collections.Collection.UpdateResult}
@throws {carbond.collections.errors.CollectionError}