Skip to content

Commit dfd96dc

Browse files
Update lib/model.js
Co-authored-by: Djamel Benali <[email protected]>
1 parent 3696a0d commit dfd96dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3688,7 +3688,7 @@ Model.castObject = function castObject(obj, options) {
36883688
}
36893689

36903690
if (schemaType.$isMongooseDocumentArray) {
3691-
const castNonArraysOption = schemaType.options.castNonArrays != null ? schemaType.options.castNonArrays : schemaType.constructor.options.castNonArrays;
3691+
const castNonArraysOption = schemaType.options?.castNonArrays ??schemaType.constructor.options.castNonArrays;
36923692
if (!Array.isArray(val)) {
36933693
if (!castNonArraysOption) {
36943694
if (!options.ignoreCastErrors) {

0 commit comments

Comments
 (0)