← back to clip · use your browser's Print / Save as PDF (Ctrl+P).

Nested Vector

by anon · 2026-06-03 15:26:32

You 🧑

Check the mongodb blog rss in my news feed and see if we released querying arrays of embeddings in vector search

▶ Tool: read_file [path='~/skills/skill_index.md']

▶ Tool: read_file [path='~/skills/news/news_skill.md']

▶ Tool: read_file [path='~/skills/rss/rss_skill.md']

▶ Tool: run_bash [command='python ~/skills/rss/fetch_rss.py https://www.mongo]…

▶ Tool: run_bash [command='python ~/skills/rss/fetch_rss.py https://www.mongo]…

▶ Tool: fetch_url [url='https://www.mongodb.com/products/updates/public-previe]…

Assistant 🤖

Yes! We did! Here's what I found in your news feed:


✅ Public Preview: Vector Search over Nested Embeddings 🎉

Released: April 30, 2026 — from the MongoDB Product Updates feed

What it is

Atlas Vector Search now supports $vectorSearch queries for vector embeddings stored within arrays of subdocuments. This means you can query nested content — like chunks within a document, reviews within a product, or messages within a conversation — and retrieve the parent document ranked by the best or average match among its children.

Who it's for

Developers building RAG applications and semantic search systems on hierarchically structured data who want to run vector similarity search against nested content without restructuring their data model.

Why it matters

Apps can perform vector similarity search directly against nested document structures, preserving MongoDB's embedded document pattern without duplicating parent metadata or flattening hierarchical collections.

How to get started

  1. Add a nestedRoot field to your vector search index definition pointing to the target array
  2. Query with $vectorSearch using the nested vector path

Also check out

The companion blog post: "Search the Way You Model: Nested Embeddings in MongoDB Atlas" — it goes into more depth on the feature.

So yes — MongoDB released exactly this capability! 🚀

You 🧑

Is this public preview or GA?

Assistant 🤖

It's currently in Public Preview — not GA yet.

From the Product Updates feed (item #9):

No GA announcement has appeared in the feed since then. So if you're waiting for the GA release to use it in production, it hasn't shipped as GA yet!

You 🧑

Give an example index definition that uses the nested root thing

▶ Tool: web_search [max_results=10, query='MongoDB Atlas Vector Search nested e]…

▶ Tool: fetch_url [url='https://www.mongodb.com/docs/atlas/atlas-vector-search]…

▶ Tool: web_search [max_results=10, query='site:mongodb.com nestedRoot vector s]…

▶ Tool: web_search [max_results=10, query='"nestedRoot" "vectorSearch" MongoDB ]…

▶ Tool: web_search [max_results=10, query='"Search the Way You Model" "Nested E]…

▶ Tool: fetch_url [url='https://www.mongodb.com/company/blog/product-release-a]…

▶ Tool: web_search [max_results=10, query='site:mongodb.com/docs/atlas nestedRo]…

▶ Tool: fetch_url [url='https://www.mongodb.com/docs/api/doc/atlas-admin-api-v]…

▶ Tool: web_search [max_results=10, query='mongodb nested embeddings vector sea]…

▶ Tool: fetch_url [url='https://www.mongodb.com/docs/atlas/atlas-vector-search]…

▶ Tool: web_search [max_results=10, query='"nestedRoot" "vectorSearch" mongodb ]…

▶ Tool: web_search [max_results=10, query='mongodb atlas vector search nested e]…

▶ Tool: web_search [max_results=10, query='mongodb nested embeddings vector sea]…

▶ Tool: fetch_url [url='https://www.mongodb.com/docs/api/doc/atlas-admin-api-v]…

▶ Tool: run_bash [command='curl -s "https://www.mongodb.com/docs/api/doc/atla]…

▶ Tool: run_bash [command='curl -sL "https://www.mongodb.com/docs/api/doc/atl]…

▶ Tool: web_search [max_results=10, query='mongodb "nestedRoot" vectorSearch in]…

▶ Tool: web_search [max_results=10, query='site:mongodb.com/docs "nested embedd]…

▶ Tool: run_bash [command='# Try to download the OpenAPI spec YAML directly\n]…

▶ Tool: web_search [max_results=10, query='mongodb vector search index "nestedR]…

▶ Tool: fetch_url [url='https://www.withone.ai/knowledge/mongo-db-atlas-admini]…

Assistant 🤖

Now I have enough info. Here's an example index definition using nestedRoot:


Index Definition with nestedRoot

Consider a collection of documents where each book has an array of chunked sections, each with its own embedding:

{

"_id": "book123",

"title": "Moby Dick",

"author": "Herman Melville",

"chunks": [

{

"text": "Call me Ishmael...",

"embedding": [0.012, 0.045, ...]

},

{

"text": "Some years ago...",

"embedding": [0.078, 0.091, ...]

}

]

}

The Vector Search index definition (for the JSON Editor in Atlas UI or API) would be:

{

"type": "vectorSearch",

"definition": {

"fields": [

{

"type": "vector",

"path": "embedding",

"numDimensions": 768,

"similarity": "cosine"

}

],

"nestedRoot": "chunks"

}

}

Key points: - nestedRoot is set at the definition level (sibling to fields), pointing to the top-level array path ("chunks") that contains the subdocuments with embeddings. - The vector field path ("embedding") is relative to each subdocument inside that array. - You can also add "filter" type fields for pre-filtering, both at the parent level and inside the nested subdocuments.

Then, to query, you'd use $vectorSearch with the same path:

db.books.aggregate([

{

$vectorSearch: {

index: "nested_vector_index",

path: "embedding",

queryVector: [0.012, 0.045, ...],

numCandidates: 100,

limit: 10,

scoreMethod: "max" // <-- "max" or "avg" for nested scoring

}

}

])

The scoreMethod parameter controls how child-level similarity scores roll up: - "max" — rank by the single best-matching child subdocument - "avg" — rank by the average similarity across all child subdocuments