From 6cda85dedf1aec898dcdb53aa56238db8989ccfa Mon Sep 17 00:00:00 2001 From: erfanva Date: Wed, 30 Oct 2024 21:03:39 +0330 Subject: [PATCH] fix: nested array issue on creation --- src/resource.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resource.ts b/src/resource.ts index 565db22..d16b72d 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -108,7 +108,8 @@ class Resource extends BaseResource { async create(params) { const parsedParams = this.parseParams(params) - let mongooseDocument = new this.MongooseModel(parsedParams) + const unflattedParams = flat.unflatten(parsedParams) + let mongooseDocument = new this.MongooseModel(unflattedParams) try { mongooseDocument = await mongooseDocument.save() } catch (error) {