From 8674ad4bb5f42ede2a4649b0980b7525cc2a9d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Lindstr=C3=B6m?= Date: Tue, 16 Nov 2021 10:33:20 +0100 Subject: [PATCH] Add regex check to 12 length string in isValid Issue with description filed here. https://jira.mongodb.org/browse/DRIVERS-1989 --- src/objectid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objectid.ts b/src/objectid.ts index dcd8cd6a..a7c769b8 100644 --- a/src/objectid.ts +++ b/src/objectid.ts @@ -298,7 +298,7 @@ export class ObjectId { } if (typeof id === 'string') { - return id.length === 12 || (id.length === 24 && checkForHexRegExp.test(id)); + return (id.length === 12 || id.length === 24) && checkForHexRegExp.test(id)); } if (id instanceof ObjectId) {