You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document.save() does not save updates to a nested object of a Document's Subdocument if the nested object is defined as { nested: { type: { a: String }, default: { } } }.
If the current behavior is a bug, please provide the steps to reproduce.
I'm not 100% sure but i think it could be that your processing-attribute gets the type of "mixed" (https://mongoosejs.com/docs/schematypes.html#mixed). So you would need to mark it as "modified" before saving, so mongoose knows that it needs to sve that too.
Can you check if my guess is right and give feedback?
@mhombach is right, { nested: { type: { a: String }, default: { } } is the same as { nested: { type: {}, default: {} } }, see mixed docs. We have an issue open to track this here: #7181 so feel free to make comments there.
As a workaround, do this:
constDataFeedMappingPair=newSchema({processing: {type: newSchema({// <-- wrap in `new Schema()` to avoid mongoose interpretting it as mixedformula: {type: String},}),default: {},},});
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
Document.save() does not save updates to a nested object of a Document's Subdocument if the nested object is defined as
{ nested: { type: { a: String }, default: { } } }
.If the current behavior is a bug, please provide the steps to reproduce.
Schemas:
Code:
It does not save updates.
What is the expected behavior?
dataFeed.mapping.id(mappingPairId).processing.formula
should be set to a provided value in the DB.Please mention your node.js, mongoose and MongoDB version.
Node.js v10.6.0, mongoose@5.4.4, mongodb@3.1.10
The text was updated successfully, but these errors were encountered: