From 84e52448f51b6604ba0dfe497820581f196acb7f Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 9 Jun 2023 21:33:33 +0800 Subject: [PATCH] fix: model toJSON --- packages/core/server/src/middlewares/data-template.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/server/src/middlewares/data-template.ts b/packages/core/server/src/middlewares/data-template.ts index 96a0254d0..6cc066457 100644 --- a/packages/core/server/src/middlewares/data-template.ts +++ b/packages/core/server/src/middlewares/data-template.ts @@ -8,7 +8,7 @@ export const dateTemplate = async (ctx: Context, next) => { await next(); if (isTemplate && actionName === 'get' && fields.length > 0) { - ctx.body = traverseJSON(ctx.body?.toJSON(), { + ctx.body = traverseJSON(JSON.parse(JSON.stringify(ctx.body)), { collection: ctx.db.getCollection(resourceName), include: fields, });