From ff86b84c14c631c2b9f91c098a7fcb2f69b9dcd7 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 12 May 2023 12:43:44 +0800 Subject: [PATCH] fix: fix updateGroupConfig not work problem replace value set with mongo set --- server/services/core/group/group.service.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/services/core/group/group.service.ts b/server/services/core/group/group.service.ts index 243aa222..94794605 100644 --- a/server/services/core/group/group.service.ts +++ b/server/services/core/group/group.service.ts @@ -437,9 +437,19 @@ class GroupService extends TcService { throw new NoPermissionError(t('没有操作权限')); } - const group = await this.adapter.model.findById(groupId).exec(); - group.config[configName] = configValue; - await group.save(); + const group = await this.adapter.model.findOneAndUpdate( + { + _id: String(groupId), + }, + { + $set: { + [`config.${configName}`]: configValue, + }, + }, + { + new: true, + } + ); this.notifyGroupInfoUpdate(ctx, group); }