ethanresnick / json-api

Turn your node app into a JSON API server (http://jsonapi.org/)
GNU Lesser General Public License v3.0
268 stars 41 forks source link

Patch requests problem #180

Open aggelos24 opened 6 years ago

aggelos24 commented 6 years ago

I am using json-api, GET and POST requests have no problem. Every time, I tried PATCH requests, the response was 500 Internal Error. It took long time to figure out what was wrong. What I finally discovered, was that the problem was in schema declaration where I set { versionKey: false }, everything works fine without it. I dont know if this behavior is considered normal. Even if it is, it has to be mentioned somewhere in the documentation.

ethanresnick commented 6 years ago

I dont know if this behavior is considered normal. Even if it is, it has to be mentioned somewhere in the documentation.

Yeah, it would make sense to document this. Basically, versionKey: true is required in the schema because the MongooseAdapter uses (and updates) the version key as a form of optimistic concurrency control.