Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mako87 opened this issue Oct 15, 2016 · 1 comment
Closed

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

mako87 opened this issue Oct 15, 2016 · 1 comment
Assignees
Labels

Comments

@mako87
Copy link

mako87 commented Oct 15, 2016

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];
    });
  }
@jmdobry
Copy link
Member

jmdobry commented Oct 17, 2016

Fixed in 3.0.0-rc.3

@jmdobry jmdobry closed this as completed Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants