From b8ebeff71c4fdec1c808e7213db8d1259a9fe366 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 7 Feb 2024 15:18:17 +0100 Subject: [PATCH] Add comments --- packages/server/src/utilities/scriptRunner.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/server/src/utilities/scriptRunner.ts b/packages/server/src/utilities/scriptRunner.ts index 9fc4e81693..ba8206fc83 100644 --- a/packages/server/src/utilities/scriptRunner.ts +++ b/packages/server/src/utilities/scriptRunner.ts @@ -22,6 +22,11 @@ class ScriptRunner { }) if (parseBson) { + // If we need to parse bson, we follow the next steps: + // 1. Serialise the data from potential BSON to buffer before passing it to the isolate + // 2. Deserialise the data within the isolate, to get the original data + // 3. Process script + // 4. Stringify and parse result in order to convert the result from BSON to json script = `return JSON.parse(JSON.stringify((function(){data=deserialize(data).data;${script}})()));` }