Skip to content

Commit 06b7239

Browse files
committed
fix: isObjectIDProperty array param check
fixes #645 Signed-off-by: Rifa Achrinza <[email protected]>
1 parent 34cfe62 commit 06b7239

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mongodb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ function isObjectIDProperty(modelCtor, propDef, value, options) {
21672167
if (!propDef) return false;
21682168

21692169
if ((typeof value === 'string' && value.match(ObjectIdValueRegex)) ||
2170-
(Array.isArray(value) && value.every((v) => v.match(ObjectIdValueRegex)))) {
2170+
(Array.isArray(value) && value.every((v) => typeof v === 'string' && v.match(ObjectIdValueRegex)))) {
21712171
if (isStoredAsObjectID(propDef)) return true;
21722172
else return !isStrictObjectIDCoercionEnabled(modelCtor, options);
21732173
} else if (value instanceof mongodb.ObjectID) {

0 commit comments

Comments
 (0)