From 06b7239c3dc92f8dc91aa2944dd9576b6917a072 Mon Sep 17 00:00:00 2001 From: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> Date: Wed, 22 Sep 2021 17:12:25 +0800 Subject: [PATCH] fix: isObjectIDProperty array param check fixes https://github.com/loopbackio/loopback-connector-mongodb/issues/645 Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> --- lib/mongodb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mongodb.js b/lib/mongodb.js index 66bea5c9e..f8a4c4d41 100644 --- a/lib/mongodb.js +++ b/lib/mongodb.js @@ -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) {