Skip to content

Update unchanged record return exception 'not found' (v3) #24

@mako87

Description

@mako87

I'm looking that update command return exception "not found" with unchanged record.
It is ambiguous or normal ?

"js-data": "^3.0.0-rc.6",
"js-data-rethinkdb": "^3.0.0-rc.2",

_update: function _update(mapper, id, props, opts) {
    var _this5 = this;

    props || (props = {});
    opts || (opts = {});

    var updateOpts = this.getOpt('updateOpts', opts);
    updateOpts.returnChanges = true;

    return this.selectTable(mapper, opts).get(id).update(props, updateOpts).run(this.getOpt('runOpts', opts)).then(function (cursor) {
      var record = void 0;
      _this5._handleErrors(cursor);
      if (cursor && cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {
        record = cursor.changes.length ? cursor.changes[0].new_val : Object.assign(props,{id:id});
      } else {
        throw new Error('Not Found');
      }
      return [record, cursor];
    });
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions