diff --git a/src/pages/api/users/update.ts b/src/pages/api/users/update.ts index 681cca55..9ba975f2 100644 --- a/src/pages/api/users/update.ts +++ b/src/pages/api/users/update.ts @@ -79,6 +79,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { let user = await db.collection("users").findOne({id: queryId ? (queryId as string) : req.session.user.id}); const updatedUser = req.body as User & {password?: string; newPassword?: string}; + delete (updatedUser as any)._id if (!!queryId) { await db.collection("users").updateOne({id: queryId}, {$set: updatedUser});