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

Insertion failure when replacing a same document containing dbref #1216

smeng9 opened this issue Dec 7, 2018 · 0 comments

Insertion failure when replacing a same document containing dbref #1216

smeng9 opened this issue Dec 7, 2018 · 0 comments


Copy link

@smeng9 smeng9 commented Dec 7, 2018

Expected Behavior

The expected behavior when replacing a document with the same document requested, PyEve should always accept the document.

For example:

  1. modify the "works" definition in
    change the work owner's type from objectid to dbref.
  2. manually modify the test database with appropriate dbref data structure.
  3. make a request to the work document endpoint
    it will return
    {"_created": "Fri, 07 Dec 2018 19:07:07 GMT", "_id": "5c0ac4db3cad1f378bc436fe", "_links": {"collection": {"href": "works", "title": "works"}, "parent": {"href": "/", "title": "home"}, "self": {"href": "works/5c0ac4db3cad1f378bc436fe", "title": "Work"}}, "_updated": "Fri, 07 Dec 2018 19:18:33 GMT", "description": "Description #0", "id": "5c0ac4db3cad1f378bc436fe", "owner": {"$id": "5c0ac4db3cad1f378bc436fd", "$ref": "people"}, "title": "Book Title #0"}
    the owner now has two keys: $id and $ref
  4. make a put request to replace the original document endpoint, it should return with no error.

In short, executing
curl http://localhost:5000/works/5c0ac4db3cad1f378bc436fe -o curl.txt
curl -X PUT -d @curl.txt --header "Content-Type: application/json" http://localhost:5000/works/5c0ac4db3cad1f378bc436fe
should produce no error

Actual Behavior

the second request produced the following 422 error
{"_issues": {"owner": "must be of dbref type"}, "_status": "ERR"}

However, if I change owner from $ref to $col in the txt file, it will be able to replace the original document.
Seems the dbref fields are not defined consistently, and will cause confusion when actually using it.


  • Python version: 3.7.1
  • Eve version: 0.8.1
nicolaiarocci added a commit that referenced this issue Mar 30, 2019
Closes #1216
@nicolaiarocci nicolaiarocci added this to the 0.8.2 milestone Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants