-
Notifications
You must be signed in to change notification settings - Fork 65
__v versionKey gets deleted in document #45
Comments
Can you provide an example that breaks the updates? |
any call of findOneAndUpdate will run your 'pre' hook. Your hook sets the __v to undefined. After your hook runs the document is saved without the __v. So I believe an example would be calling a findOneAndUpdate and then after that is done, trying to update the document using save. The save pre hook does not have this issue of setting the __v to undefined. |
Hey @nassor, I think @brianmtully is referring to the original document's |
Same issue occur when I use |
For now I did change the default mongoose version key name to another, instead of the default |
When using versionKeys in schema. The versionKey gets deleted when using this package.
`
function createHistoryDoc(d, operation) {
d.__v = undefined;
}
`
In the createHistoryDoc function, it sets the __v of the main document to undefined. This breaks updates on the document in the future. Big problem.
The text was updated successfully, but these errors were encountered: