-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Developer Tools
Background
numCandidates parameter is becoming optional in $vectorSearch (CLOUDP-326465): when omitted, mongot computes a value automatically. The GUI/editor tooling still presents it as required. The $vectorSearch stage template + autocomplete completion are defined in @mongodb-js/mongodb-constants (packages/mongodb-constants/src/stage-operators.ts in mongodb-js/devtools-shared) and consumed by Compass, Data Explorer (via Compass components), the VS Code extension, and mongosh.
- The inserted snippet hardcodes the parameter: numCandidates: ${4:numCandidates}, (~L1355 / L1397).
- The completion description labels it required: "numCandidates: … You can specify a number higher than the number of documents to return (limit) to increase accuracy. (Required)" (~L1345 / L1384).
Proposed changes
1. @mongodb-js/mongodb-constants — stage-operators.ts (both $vectorSearch variants):
- Remove numCandidates from the default inserted snippet (optional field; consistent with the SWP/Data Explorer template proposal in EXPO-6717).
- Update the completion description: drop "(Required)", mark Optional, reflect new behavior + tuning guidance (copy below).
2. Downstream version bumps: bump @mongodb-js/mongodb-constants in Compass, the VS Code extension (pinned ^0.16.1 — stale), and mongosh. Data Explorer inherits via its Compass dependency. VS Code has no hardcoded $vectorSearch snippet of its own.
Copy :
numCandidates (optional) — The number of nearest-neighbor candidates to consider during the search. Omit it and MongoDB automatically selects a value based on your limit, index size, quantization, and filters. Set it yourself to tune the recall/latency tradeoff: higher values increase accuracy at the cost of latency.
Template comment : // numCandidates (optional): Omit and MongoDB automatically selects a value based on your limit, index size, quantization, and filters. Set it yourself to tune recall/latency by hand.
- related to
-
COMPASS-11146 Aggregate button on auto-embedding vectorSearch index populates BYOE $vectorSearch stage instead of auto-embedding stage
-
- Backlog
-