_markModified is not a function
See original GitHub issueWas getting the following error after upgrading to latest mongoose:
\node_modules\mongoose\lib\types\embedded.js:68
this.__parentArray._markModified();
^
TypeError: undefined is not a function
at EmbeddedDocument.markModified (\node_modules\mongoose\lib\types\embedded.js:68:24)
at SchemaArray.cast (\node_modules\mongoose\lib\schema\array.js:180:9)
at SchemaArray.SchemaType.getDefault (\node_modules\mongoose\lib\schematype.js:587:23)
at EmbeddedDocument.Document.$__buildDoc (\node_modules\mongoose\lib\document.js:243:22)
at EmbeddedDocument.Document (\node_modules\mongoose\lib\document.js:61:20)
at new EmbeddedDocument (\node_modules\mongoose\lib\types\embedded.js:30:12)
at EmbeddedDocument (\node_modules\mongoose\lib\schema\documentarray.js:27:17)
at DocumentArray.SchemaArray (\node_modules\mongoose\lib\schema\array.js:61:21)
at new DocumentArray (\node_modules\mongoose\lib\schema\documentarray.js:46:13)
at Function.Schema.interpretAsType (\node_modules\mongoose\lib\schema.js:582:14)
at Schema.path (\node_modules\mongoose\lib\schema.js:527:29)
at Schema.add (\node_modules\mongoose\lib\schema.js:411:12)
at new Schema (\node_modules\mongoose\lib\schema.js:98:10)
at Object.<anonymous> (\modules\project\server\models\project.server.model.js:71:21)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at \config\lib\mongoose.js:15:5
at Array.forEach (native)
Changing
EmbeddedDocument.prototype.markModified = function(path) {
this.$__.activePaths.modify(path);
if (!this.__parentArray) {
return;
}
to
EmbeddedDocument.prototype.markModified = function(path) {
this.$__.activePaths.modify(path);
if (!this.__parentArray || !this.__parentArray._markModified) {
return;
}
on node_modules\mongoose\lib\types\embedded.js seems to do the trick
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:13
Top Results From Across the Web
Understanding markModified() in Mongoose
By default, mongoose would not persists the change of mixed array columns ... mongoose calls the $__handleSave() function from $__save() and ...
Read more >Mongo/Mongoose - markModified not working - Stack Overflow
When I log the doc inside the .save function it appears to have saved successfully. However on querying the db elsewhere the save...
Read more >Mongoose v6.8.1: Document
[fn] «Function». Initializes the document without setters or marking anything modified. Called internally after a document is returned from mongodb. Normally, ...
Read more >Mongo/Mongoose - markModified not working-mongodb
When I log the doc inside the .save function it appears to have saved successfully. However on querying the db elsewhere the save...
Read more >Scripting API: Mesh.MarkModified - Unity - Manual
A manual call to MarkModified can be used later to notify the dependent renderer components of a mesh geometry change. MarkModified function only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vkarpov15 can’t say exactly anymore, happened in the “hydration” from json to models with subdocuments.
@ashishdommety can you please open up a separate issue with code samples?