We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3696a0d commit dfd96dcCopy full SHA for dfd96dc
lib/model.js
@@ -3688,7 +3688,7 @@ Model.castObject = function castObject(obj, options) {
3688
}
3689
3690
if (schemaType.$isMongooseDocumentArray) {
3691
- const castNonArraysOption = schemaType.options.castNonArrays != null ? schemaType.options.castNonArrays : schemaType.constructor.options.castNonArrays;
+ const castNonArraysOption = schemaType.options?.castNonArrays ??schemaType.constructor.options.castNonArrays;
3692
if (!Array.isArray(val)) {
3693
if (!castNonArraysOption) {
3694
if (!options.ignoreCastErrors) {
0 commit comments