Schema with subDoc fails to extend
Closed this issue · 5 comments
Hi,
When adding the field 'layout' to the existing VehicleSchema definition in test discriminator.js,
var VehicleSchema = new mongoose.Schema({
make: String,
layout: [LayoutSchema]
}, ....
produces the following error:
TypeError: Object #<Object> has no method '_markModified'
at EmbeddedDocument.markModified (/home/donnut/dev/js/node_modules/mongoose/lib/types/embedded.js:63:24)
Object is this.__parentArray in embedded.js
I came across the same issue. I had a quick look at it, and it seems that there was a problem cloning the parent schema. I tried using a couple different cloning modules in place, and found one that works (owl-deepcopy).
I forked my fix to https://github.com/motherinc/mongoose-schema-extend
Thanks, I'll give it a try.
Hi,
I got the same error after defining a subdoc. Your post of fixing that issus ist 9 days ago. Can I download these fix somewhere?
I issued a pull request, but it has not been pulled yet. You can download my modified version of this module here: https://github.com/motherinc/mongoose-schema-extend
Make sure you also install owl-deepcopy (you can use npm for that)
thanks a lot!