From e7accd111362648d0ea9cd8cece89c9c4f9985f4 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:01:00 +0000 Subject: [PATCH] backport fix for update-score.ts --- server/src/lib/score-mutation/update-score.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/lib/score-mutation/update-score.ts b/server/src/lib/score-mutation/update-score.ts index cf44c4be7..032cc520c 100644 --- a/server/src/lib/score-mutation/update-score.ts +++ b/server/src/lib/score-mutation/update-score.ts @@ -67,6 +67,14 @@ export default async function UpdateScore(oldScore: ScoreDocument, newScore: Sco ); try { + if (newScore._id) { + logger.warn( + `Passed a score with _id to UpdateScore. This property should not be set. Deleting this property and continuing anyway.` + ); + // This property shouldn't be defined. + delete newScore._id; + } + await db.scores.update( { scoreID: oldScoreID,