rudiment.js
function(doc, updates) {
      updates = this._in_map(updates || {});

      Object.keys(doc).forEach(function(prop) {
        if (updates.hasOwnProperty(prop)) {
          doc[prop] = updates[prop];
        }
      });

      if (!this.isValid(doc)) {
        throw new Error('Updated document is invalid');
      }

      var id = doc[this._dbType.id];

      this._uniq.forEach(function(uniq) {
        delete doc[uniq];
      });

      doc = this.clean(doc);
      return this._dbApi.update(id, doc);
    }
function(doc, updates) {
      updates = this._in_map(updates || {});

      Object.keys(doc).forEach(function(prop) {
        if (updates.hasOwnProperty(prop)) {
          doc[prop] = updates[prop];
        }
      });

      if (!this.isValid(doc)) {
        throw new Error('Updated document is invalid');
      }

      var id = doc[this._dbType.id];

      this._uniq.forEach(function(uniq) {
        delete doc[uniq];
      });

      doc = this.clean(doc);
      return this._dbApi.update(id, doc);
    }
function ( doc , updates ) { updates = this . _in_map ( updates || { } ) ; Object . keys ( doc ) . forEach ( function ( prop ) { if ( updates . hasOwnProperty ( prop ) ) { doc [ prop ] = updates [ prop ] ; } } ) ; if ( ! this . isValid ( doc ) ) { throw new Error ( 'Updated document is invalid' ) ; } var id = doc [ this . _dbType . id ] ; this . _uniq . forEach ( function ( uniq ) { delete doc [ uniq ] ; } ) ; doc = this . clean ( doc ) ; return this . _dbApi . update ( id , doc ) ; }
Update an existing database document

The unique values of a document cannot be updated with this method.
Delete the document and create a new document instead.

@private

@param {Document} doc
@param {Object} updates - updates to apply to document
@return {Promise}
Update an existing database document