Closed seawatts closed 6 years ago
Running the save lifecycle hook in v2 was intentional; that approach was used for the more complete validation that the read-then-resave pattern allows. However, it came with other downsides and has been changed in v3 to work as you requested.
See the v3 changelog for details + rationale. https://github.com/ethanresnick/json-api/blob/06519812803fa72aa097ba0a6e88ad1ac3d715c2/UPGRADING.md#mongoose-behaviormongooseadapter
The current implementation seems to call
.save()
on the model when issuing aPATCH
request. By doing so this calls the mongoosesave
lifecycle hook I believe calling.update()
on the document should fix this. (I haven't tested this out yet)It also seems that you referenced Mongoose 4.x, which has been released, is this comment just out of date?