doc.set({ field: undefined }) does nothing if the schema has strict: false #15192
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
7.8.6
Node.js version
22.11.0
MongoDB server version
8.0.4
Typescript version (if applicable)
5.7.3
Description
If the schema has
strict: false
, you can't usedoc.set({ field: undefined })
to unset a field. Instead, you have to usedoc.set('field', undefined)
ordoc.field = undefined
.Steps to Reproduce
Expected Behavior
The text was updated successfully, but these errors were encountered: