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

Upsert fails to create document when id provided, throws 404 NOT FOUND #110

Closed
1 of 2 tasks
djorg83 opened this issue Apr 26, 2017 · 1 comment
Closed
1 of 2 tasks
Assignees
Labels

Comments

@djorg83
Copy link

djorg83 commented Apr 26, 2017

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

The create portion of upsert does not work if an id is supplied in the data argument.

Sample upsert call

MyModel.upsert({
  myId: 'some-value',
  otherData: 'something'
});

Model definition

{
  "name": "MyModel",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "myId": {
      "type": "string",
      "id": true,
      "required": true
    },
    "otherData": {
      "type": "string"
    }
  },
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}

Link to sample repo to reproduce issue (if bug)

Expected result

Document should be created if not found by id.

Actual result (if bug)

404 is thrown. Received error message: No instance with id df97cbcd-8246-49ee-9354-599e8fe64e2f found for MyModel

Cause

This commit d5dd8c7 caused the upsert to break.

Additional information (Node.js version, LoopBack version, etc)

loopback-connector-cloudant: 1.2.2
Node Version: 6.0.0

@jannyHou
Copy link
Contributor

Closing since #129 merged

@0candy 0candy added the apex label May 24, 2017
@0candy 0candy added this to the Sprint 36 - Apex milestone May 24, 2017
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

3 participants