From a938ade36057e5ac2838845d5e8adbe57f4d7193 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 13 Oct 2024 12:29:20 +0300 Subject: [PATCH] bugfix --- src/MongoDB.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MongoDB.ts b/src/MongoDB.ts index 43184f3..2ff1077 100644 --- a/src/MongoDB.ts +++ b/src/MongoDB.ts @@ -44,7 +44,7 @@ export const parseValidationError = (error: MongoServerError) => { if (error.code !== 121 || !error.errInfo) throw new Error('Not a validation error'); - const rule = error.errInfo.details.schemaRulesNotSatisfied; + const [ rule ] = error.errInfo.details.schemaRulesNotSatisfied; const missing = rule.missingProperties as string[]; const required = rule.specifiedAs.required as string[]; return { missing, required };