diff --git a/packages/builder/src/components/integration/index.svelte b/packages/builder/src/components/integration/index.svelte index d07f395a01..e3d9eab414 100644 --- a/packages/builder/src/components/integration/index.svelte +++ b/packages/builder/src/components/integration/index.svelte @@ -44,9 +44,12 @@ } function setEditorTemplate(fromKey, toKey, index) { + const currentValue = query.fields.steps[index].value.value if ( + !currentValue || + currentValue.toString().replace("\\s", "").length < 3 || schema.steps.filter(step => step.key === fromKey)[0]?.template === - query.fields.steps[index].value.value + currentValue ) { query.fields.steps[index].value.value = schema.steps.filter( step => step.key === toKey diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 1cb24921b7..eeff616cbd 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -138,11 +138,16 @@ const SCHEMA: Integration = { { key: "$geoNear", template: `{ - "near": { "type": "Point", "coordinates": [ -73.98142 , 40.71782 ] }, + "near": { + "type": "Point", + "coordinates": [ + -73.98142, 40.71782 + ] + }, "key": "location", "distanceField": "dist.calculated", "query": { "category": "Parks" } -}` +}`, }, { key: "$graphLookup", @@ -155,7 +160,7 @@ const SCHEMA: Integration = { "maxDepth": 1, "depthField": "", "restrictSearchWithMatch": {} -}` +}`, }, { key: "$group", @@ -186,7 +191,7 @@ const SCHEMA: Integration = { "localField": "", "foreignField": "", "as": "" -}` +}`, }, { key: "$match", @@ -199,14 +204,14 @@ const SCHEMA: Integration = { "on": "_id", "whenMatched": "replace", "whenNotMatched": "insert" -}` +}`, }, { key: "$out", template: `{ "db": "", "coll": "" -}` +}`, }, { key: "$planCacheStats", @@ -261,7 +266,7 @@ const SCHEMA: Integration = { template: `{ "coll": "", "pipeline": [] -}` +}`, }, { key: "$unset", @@ -273,7 +278,7 @@ const SCHEMA: Integration = { "path": "", "includeArrayIndex": "", "preserveNullAndEmptyArrays": true -}` +}`, }, ], },