Skip to content

Commit

Permalink
fix: isObjectIDProperty array param check
Browse files Browse the repository at this point in the history
fixes #645

Signed-off-by: Rifa Achrinza <[email protected]>
  • Loading branch information
achrinza committed Oct 2, 2021
1 parent 34cfe62 commit 06b7239
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,7 @@ function isObjectIDProperty(modelCtor, propDef, value, options) {
if (!propDef) return false;

if ((typeof value === 'string' && value.match(ObjectIdValueRegex)) ||
(Array.isArray(value) && value.every((v) => v.match(ObjectIdValueRegex)))) {
(Array.isArray(value) && value.every((v) => typeof v === 'string' && v.match(ObjectIdValueRegex)))) {
if (isStoredAsObjectID(propDef)) return true;
else return !isStrictObjectIDCoercionEnabled(modelCtor, options);
} else if (value instanceof mongodb.ObjectID) {
Expand Down

0 comments on commit 06b7239

Please sign in to comment.