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 };