From 8e8e1b0b7106f8aaceea8f939f344378c695e47e Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Fri, 13 Jun 2025 14:00:30 -0400 Subject: [PATCH 1/2] feat(mongodb-constants): add stage for 8.1+ COMPASS-9429 --- .../mongodb-constants/src/stage-operators.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/mongodb-constants/src/stage-operators.ts b/packages/mongodb-constants/src/stage-operators.ts index 0ba36836..abbbb401 100644 --- a/packages/mongodb-constants/src/stage-operators.ts +++ b/packages/mongodb-constants/src/stage-operators.ts @@ -749,6 +749,48 @@ const STAGE_OPERATORS = [ `, snippet: `{ \${1:specification(s)} +}`, + }, + { + name: '$rankFusion', + value: '$rankFusion', + label: '$rankFusion', + outputStage: false, + fullScan: false, + firstStage: false, + score: 1, + env: [ATLAS], + meta: 'stage', + version: '8.1.0', + apiVersions: [], + namespaces: [COLLECTION], + description: + 'Combines multiple pipelines using reciprocal rank fusion to create hybrid search results.', + comment: `/** + * input.pipelines: Required. Map from name to input pipeline. Each pipeline must be a Ranked Selection Pipeline operating on the same collection. Minimum of one pipeline. + * combination.weights: Optional. Map from pipeline name to numbers (non-negative). If unspecified, default weight is 1 for each pipeline. + * scoreDetails: Optional. Default false. Set to true to include detailed scoring information in {$meta: "scoreDetails"} for debugging and tuning. + */ +`, + snippet: `{ + input: { + pipelines: { + \${1:searchPipeline}: [ + {$search: {\${2:searchStage}}}, + {$limit: \${3:limit}} + ], + \${4:vectorPipeline}: [ + {$vectorSearch: {\${5:vectorSearchStage}}} + ] + } + }, + combination: { + weights: { + \${1:searchPipeline}: \${6:number}, + \${4:vectorPipeline}: \${7:number} + } + }, + scoreDetails: \${8:false} }`, }, { From 0b1472a6794d3896134de36eb8711e4fde78a3f8 Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Wed, 18 Jun 2025 14:10:55 -0400 Subject: [PATCH 2/2] fixup: snippet numbering --- packages/mongodb-constants/src/stage-operators.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mongodb-constants/src/stage-operators.ts b/packages/mongodb-constants/src/stage-operators.ts index abbbb401..8f832910 100644 --- a/packages/mongodb-constants/src/stage-operators.ts +++ b/packages/mongodb-constants/src/stage-operators.ts @@ -786,11 +786,11 @@ const STAGE_OPERATORS = [ }, combination: { weights: { - \${1:searchPipeline}: \${6:number}, - \${4:vectorPipeline}: \${7:number} + \${6:searchPipeline}: \${7:number}, + \${8:vectorPipeline}: \${9:number} } }, - scoreDetails: \${8:false} + scoreDetails: \${10:false} }`, }, {