Closed AlexandreMagniez closed 5 years ago
Following this commit nested schemas are virtualized. But I've faced some issue due to this since some of my documents are not strictly following the Mongoose schema I've defined.
If we define the following Mongoose schema :
{ someKey: String, someArray: [ { someOtherKey: String, } ] }
... but we have one document like that :
{ "someKey": "someValue", }
... a find({}).lean({virtuals: true}) will fail with Cannot read property '_id' of undefined. This PR fixes that undesired behavior.
find({}).lean({virtuals: true})
Cannot read property '_id' of undefined
Following this commit nested schemas are virtualized. But I've faced some issue due to this since some of my documents are not strictly following the Mongoose schema I've defined.
If we define the following Mongoose schema :
... but we have one document like that :
... a
find({}).lean({virtuals: true})
will fail withCannot read property '_id' of undefined
. This PR fixes that undesired behavior.