diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index f3be29e386..cdc1b581b6 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -123,7 +123,7 @@ module MongoDBModule { let i = 0 let startIndex = 0 for (let c of params) { - if (c === '"') { + if (c === '"' && (i > 0 && params[i-1] !== '\\')) { inQuotes = !inQuotes } if (c === "{" && !inQuotes) { diff --git a/packages/server/src/integrations/tests/mongo.spec.js b/packages/server/src/integrations/tests/mongo.spec.js index 02d37b18a2..9687723528 100644 --- a/packages/server/src/integrations/tests/mongo.spec.js +++ b/packages/server/src/integrations/tests/mongo.spec.js @@ -289,7 +289,7 @@ describe("MongoDB Integration", () => { }, { "upsert": true, - "extra": "ad{d" + "extra": "ad\\"{\\"d" }`, extra: { collection: "testCollection", actionTypes: "updateOne" }, } @@ -317,7 +317,7 @@ describe("MongoDB Integration", () => { }) expect(args[2]).toEqual({ upsert: true, - extra: "ad{d" + extra: "ad\"{\"d" }) }) })