Skip to content

Commit d9decc1

Browse files
committed
fix: isObjectIDProperty array param check
fixes #645 Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
1 parent 1d8a84b commit d9decc1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mongodb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,7 @@ function isObjectIDProperty(modelCtor, propDef, value, options) {
21762176
if (!propDef) return false;
21772177

21782178
if ((typeof value === 'string' && value.match(ObjectIdValueRegex)) ||
2179-
(Array.isArray(value) && value.every((v) => v.match(ObjectIdValueRegex)))) {
2179+
(Array.isArray(value) && value.every((v) => typeof v === 'string' && v.match(ObjectIdValueRegex)))) {
21802180
if (isStoredAsObjectID(propDef)) return true;
21812181
else return !isStrictObjectIDCoercionEnabled(modelCtor, options);
21822182
} else if (value instanceof mongodb.ObjectID) {

0 commit comments

Comments
 (0)