Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed exception where a null element within an array would be attempt…
…ed to be populated. Prior to this change, if there was a wild NULL object in an array within a document, mongoose would attempt to populate it, and would crash. For example, if we had a schema containing founders array in such a way - founders: [ { legal_form: { type: mongoose.Schema.Types.ObjectId, ref: "Legal_Form" }, name: String, identification_code: String, ownership_percentage: Number, }, ], and our database contained a document with founders looking like following - [ { name: ''name", identification_code: ''id_code", ownership_percentage: 51.5, _id: new ObjectId("63e1fc49d4ff7ce99a3a3faf") }, null ] Then following error would be thrown - TypeError: Cannot read properties of null (reading 'populated')
- Loading branch information