MongoError: Updating the path '__v' would create a conflict at '__v' #7003
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using findByIdAndUpdate() or findOneAndUpdate() with the
upsert
option, a__v
key, and$unset
, the following error is thrown:This bug appears similar to #5973 which is supposed to have been fixed. As far as I can tell, the difference here is that in this case the
$unset
key is being used.If the current behavior is a bug, please provide the steps to reproduce.
When running this script, an error is thrown before the console.log.
What is the expected behavior?
The record should update without at error. Remove either
__v
,$unset
, or theupsert
option from the example and it works as expected.Please mention your node.js, mongoose and MongoDB version.
Node.js: v10.9.0
Mongoose: v5.2.14
MongoDB: v3.6.3 (with setFeatureCompatibilityVersion: 3.6)
The text was updated successfully, but these errors were encountered: