From 436cbed74bcfcbfc2e7c5b82d982d180748c5343 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 12 Oct 2022 18:54:53 +0100 Subject: [PATCH] Add support for ObjectId in aggregations --- packages/server/src/integrations/mongodb.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index eeff616cbd..70419be58b 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -564,14 +564,14 @@ class MongoIntegration implements IntegrationBase { query.steps.map(({ key, value }) => { let temp: any = {} temp[key] = JSON.parse(value.value) - return temp + return this.createObjectIds(temp) }) )) { response.push(doc) } } else { const stages: Array = query.json as Array - for await (const doc of collection.aggregate(stages ? stages : [])) { + for await (const doc of collection.aggregate(stages ? this.createObjectIds(stages) : [])) { response.push(doc) } }