MongoDB Atlas Vector Search
Parent: MongoDB Atlas · Published reference · snapshot 2026-09-08 · skill mongodb-atlas-expert/references/mongodb-atlas-vector-search.md
↓ Facts as markdownall context files
```python
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
HNSW Tuning Parameters
- Recommendation: Start with defaults. Only tune if ANN recall < 0.90 in production. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#hnsw-tuning-parameters]
Quantization
- Scalar quantization (int8): Reduces index size by ~4x; recall typically >95% vs full float [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#quantization]
- Binary quantization: Reduces by ~32x; recall ~90%; useful when memory is the constraint [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#quantization]
ANN (Approximate Nearest Neighbor)
- numCandidates: Controls recall-latency tradeoff. Higher = better recall + slower. Rule of thumb: 10-20x the limit. Hard minimum equals limit. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#ann-approximate-nearest-neighbor]
ENN (Exact Nearest Neighbor)
- ENN guarantees perfect recall but O(N) scan. Use only for: small collections (<100K docs), high-accuracy requirements, offline batch evaluation. Do not use in production at scale. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#enn-exact-nearest-neighbor]
3. Hybrid Search ($rankFusion / $scoreFusion)
- Combines semantic vector search with keyword full-text search. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#3-hybrid-search-rankfusion-scorefusion]
$rankFusion (Reciprocal Rank Fusion — recommended)
- RRF is robust to score magnitude differences between vector and full-text scores. Better than $scoreFusion when scores are on different scales. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#rankfusion-reciprocal-rank-fusion-recommended]
4. Voyage AI Auto-Embedding
- Atlas Vector Search + Voyage AI auto-embedding lets you skip the embedding pipeline entirely - Atlas embeds at index-build time and at query time. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
- Voyage 4 model family (as of 2026): [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
- voyage-4-large: 1024 dims, best quality [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
- voyage-4-lite: 512 dims, fastest + most economical [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
- voyage-4-finance: Finance-domain specialized [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
- voyage-4-code: Code and programming specialized [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#4-voyage-ai-auto-embedding]
Parent-Document Retrieval
- Index small chunks for precise retrieval, but return the parent document for full context: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#parent-document-retrieval]
Dedicated Search Nodes
- Vector Search in production should use dedicated Search Nodes to avoid resource contention with OLTP queries. HNSW graphs must fit in RAM for fast ANN. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#dedicated-search-nodes]
- 1M vectors × 1536 dims × float32 ≈ 6 GB raw; with HNSW graph ≈ 9-12 GB [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#dedicated-search-nodes]
- Use S30_HIGHCPU_NVME or larger for production vector workloads [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#dedicated-search-nodes]
- Use Storage-Optimized tiers when index exceeds RAM [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#dedicated-search-nodes]
7. Anti-Patterns
- Wrong similarity metric: Using euclidean with normalized embeddings (should use dotProduct); using cosine with unnormalized embeddings and comparing absolute distances [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- No filter fields declared in index but using filter in $vectorSearch: Causes full ANN scan before filtering, not pre-filter → worst of both worlds [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- numCandidates too low: Values close to limit severely degrade recall [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- ENN in production at scale: O(N) scan; destroys query latency for collections > 100K docs [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- Not sizing Search Nodes for vector workload: Embedded mongot on shared cluster causes OLTP latency spikes [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- Dimension mismatch: numDimensions in index must match exactly what the embedding model outputs [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
- Querying without the vector index active: Atlas returns an error or falls back to collection scan; wait for index build to complete [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#7-anti-patterns]
References
- Atlas Vector Search Documentation [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#references]
- $vectorSearch Aggregation Stage [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#references]
- Hybrid Search with $rankFusion [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#references]
- Voyage AI Auto-Embedding [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#references]
- Atlas Vector Search Quantization [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-vector-search/#references]
Where this helps
- Building semantic search or RAG retrieval on top of an existing MongoDB/Atlas deployment, without standing up a separate vector database. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Combining keyword and semantic relevance in one query via $rankFusion when neither pure full-text nor pure vector search alone returns good results. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Recommendation and similarity-matching features where embeddings already exist and need low-latency ANN lookup at query time. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Prototyping retrieval-augmented generation with Voyage AI auto-embedding, when the team wants to skip building and operating a separate embedding pipeline. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Project ideas
- Build a RAG chatbot backed by Atlas Vector Search: chunk documents, auto-embed with Voyage AI, and retrieve top-k results via $vectorSearch to ground LLM answers. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Build a hybrid product-search endpoint that fuses full-text keyword matches and vector similarity with $rankFusion so shoppers get both exact-term and semantically related results. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Implement parent-document retrieval: index small chunks for precision but return the full parent document for LLM context, avoiding retrieval fragments that lack surrounding context. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Prototype a near-duplicate detector using ENN on a small collection where exact recall matters more than query speed. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Common mistakes
- Mismatching the similarity metric to how embeddings are normalized — using euclidean on normalized vectors, or cosine while comparing raw absolute distances — both silently degrade ranking quality. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Declaring no filter fields on the vector index but still passing a filter to $vectorSearch, forcing a full ANN scan before filtering instead of a true pre-filter. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Deploying ENN on a production query path at scale, turning what should be a low-latency ANN lookup into an O(N) collection scan. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Skipping dedicated Search Nodes for production vector workloads, letting embedded mongot compete with OLTP traffic on the same cluster and causing latency spikes on both sides. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Known issues
- HNSW graphs must fit in RAM for fast ANN search, so 1M vectors at 1536 dimensions in float32 needs roughly 9-12GB with the graph — an undersized Search Node silently degrades toward disk-bound latency. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- numCandidates too close to the requested limit severely reduces recall, but pushing it too high trades latency for marginal recall gains — it needs real tuning, not a fixed default. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Querying a collection before its vector index finishes building returns an error or falls back to a collection scan rather than partial results. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- numDimensions in the index definition must exactly match what the embedding model outputs; switching embedding model tiers without re-embedding breaks the index silently. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Children
- HNSW Index Parameters (frontier, viability 3.10 / 5, below research gate)
- Vector Quantization (frontier, viability 4.22 / 5)
- Hybrid Search (frontier, viability 4.30 / 5)
- Voyage AI Embeddings (frontier, viability 3.38 / 5)
- RAG Patterns (frontier, viability 3.20 / 5)
- Search Nodes (frontier, viability 3.17 / 5, below research gate)
- Embedding Pipelines (frontier, viability 4.30 / 5)
- Multi-Vector Patterns (frontier, viability 3.73 / 5)
Frontier under this node: Embedding Pipelines (4.30), HNSW Index Parameters (3.10), Hybrid Search (4.30), Multi-Vector Patterns (3.73), RAG Patterns (3.20), Search Nodes (3.17), Vector Quantization (4.22), Voyage AI Embeddings (3.38)