Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
MongoDB Branding Shape
Register now >

EmbeddedDocuments as First-Class Citizens of MongoDB Search

November 20, 2025

What it is: When querying objects within arrays, use 'returnScope' to return only the elements that match the query, rather than returning the entire parent document with the entire array. 'returnScope' also introduces the ability to use all search features at the embedded document level, including faceting and counting across returned elements. Who it’s for: Customers who use arrays of objects to represent one-to-many relationships that need to search and filter for specific matching entities. E.g. In the 'sample_airbnb.listingsAndReviews' sample collection of vacation rentals, return 'reviews' that match a search for “clean” Why it matters: Atlas Search can be used to achieve fast searching, faceting, sorting, pagination on objects within arrays without making any changes to the existing data models. How to get started: Configure a search index definition with an embeddedDocuments type and specify 'storedSource' fields. Then, specify 'returnScope.path' and 'returnStoredSource' in the $search or $searchMeta query. Try it in the Search Playground and see the documentation to learn more.

Related Content

Tutorial

Try it in the Search Playground

Docs

See the docs to learn more