DocumentArray pull
does not work when subdocument has a defaulted field
#12294
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.5.2
Node.js version
16.x
MongoDB server version
5.x
Description
If you setup a schema which has an array of subdocuments, and the subdocument schema includes a field which has a default configured, then:
pull
the subdocument from the array by passing that subdocument to thepull
methodI believe this is because the pull operation tries to perform an exact match on the contents of the subdocument when submitting the
$pull
operation to MongoDB. It seems like it should take whether or not the field was defaulted into account when submitting the operation.Steps to Reproduce
Expected Behavior
I'd expect that regardless of if a field was defaulted or not on retrieval from the DB, the
pull
operation should still work on that subdocument.The text was updated successfully, but these errors were encountered: