Skip to content

Commit 0b5ede2

Browse files
committed
fix : $push -> $addToSet으로 중복된 Id가 들어가지 않도록 해결
Resolve: #70
1 parent 0c8a65d commit 0b5ede2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/apis/workspace/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export const join = async (userId: number, code: string) => {
2727

2828
const { id, name } = workspace;
2929

30-
await workspaceModel.updateOne({ id }, { $push: { users: userId } });
31-
await userModel.updateOne({ id: userId }, { $push: { workspaces: id } });
30+
await workspaceModel.updateOne({ id }, { $addToSet: { users: userId } });
31+
await userModel.updateOne({ id: userId }, { $addToSet: { workspaces: id } });
3232

3333
return { id, name, code };
3434
};

0 commit comments

Comments
 (0)