{ optimisticConcurrency: true }, unwanted rollback of __v #10128
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
Milestone
Environment
"mongoose": "^5.11.17"
Working with the option
{ optimisticConcurrency: true }
(overwriting versionKey does not affect behavior)High-Level Description
When relying on optimisticConcurrency to manage the versionKey, I noticed a bug, causing the versionKey to roll back.
Schema Description
The following schema was used for reproduction:
Testing Steps
The following script was used to cause the rollback:
Expected
An error on
thing_2.save();
, however operation went through sucessfully and reset version to__v:0
.Note
When setting
thing_2
dirty 'forceably' , error is thrown, as such:Manual workaround
The only manual workaround for now seems to be to set
The text was updated successfully, but these errors were encountered: