Print warning when schema type
is a POJO with non-zero number of properties
#8107
Labels
developer-experience
This issue improves error messages, debugging, or reporting
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I have the following schema:
If I
save()
an object I retrieved before, only the top-level properties are getting saved, not the nested one:Edit: This seems to be related to the
type
section I introduced to mark the nested type as optional. If I declare it like this, saving it works, but of course, the item is now required.Also, declaring the nested type as a schema of its own seems to work, so that's a fix that works:
My understanding is that nested items in arrays are not automatically updated, but this isn't one.
A workaround would be to use
markModified
with the path, but I hope that's just a dirty hack ;)I saw this reported in an earlier bug (see last comment on #6152) that was marked as resolved, but if that was fixed, it has resurfaced.
Mongoose version:
5.6.10
(I think), then upgraded to5.6.11
The text was updated successfully, but these errors were encountered: