lib/memory-engine.js
function update(object, overwrite, callback) {
    if (typeof overwrite === 'function') {
      callback = overwrite
      overwrite = false
    }
    self.emit('update', object, overwrite)
    callback = callback || emptyFn
    var id = '' + object[options.idProperty]
      , updatedObject

    checkForIdAndData(object, function (error, foundObject) {
      if (error) {
        return callback(error)
      }

      if (overwrite) {
        updatedObject = extend({}, object)
      } else {
        updatedObject = extend({}, foundObject, object)
      }

      var query = {}
        , copy = extend({}, updatedObject)
      query[ options.idProperty ] = id
      data = Mingo.remove(data, query)
      data.push(updatedObject)
      self.emit('afterUpdate', copy, overwrite)
      callback(undefined, copy)
    })
  }
function update(object, overwrite, callback) {
    if (typeof overwrite === 'function') {
      callback = overwrite
      overwrite = false
    }
    self.emit('update', object, overwrite)
    callback = callback || emptyFn
    var id = '' + object[options.idProperty]
      , updatedObject

    checkForIdAndData(object, function (error, foundObject) {
      if (error) {
        return callback(error)
      }

      if (overwrite) {
        updatedObject = extend({}, object)
      } else {
        updatedObject = extend({}, foundObject, object)
      }

      var query = {}
        , copy = extend({}, updatedObject)
      query[ options.idProperty ] = id
      data = Mingo.remove(data, query)
      data.push(updatedObject)
      self.emit('afterUpdate', copy, overwrite)
      callback(undefined, copy)
    })
  }
function update ( object , overwrite , callback ) { if ( typeof overwrite === 'function' ) { callback = overwrite overwrite = false } self . emit ( 'update' , object , overwrite ) callback = callback || emptyFn var id = '' + object [ options . idProperty ] , updatedObject checkForIdAndData ( object , function ( error , foundObject ) { if ( error ) { return callback ( error ) } if ( overwrite ) { updatedObject = extend ( { } , object ) } else { updatedObject = extend ( { } , foundObject , object ) } var query = { } , copy = extend ( { } , updatedObject ) query [ options . idProperty ] = id data = Mingo . remove ( data , query ) data . push ( updatedObject ) self . emit ( 'afterUpdate' , copy , overwrite ) callback ( undefined , copy ) } ) }
Updates a single entity. Emits an 'update' event. Optionally overwrites
the entire entity, by default just extends it with the new values.

@param {Object} object to update
@param {Boolean} whether to overwrite or extend the existing entity
@param {Function} callback (optional)
@api public
Updates a single entity . Emits an update event . Optionally overwrites the entire entity by default just extends it with the new values .