For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

$search (aggregation stage)

$search aggregation pipeline stage performs a full-text search of the field or fields in an Atlas collection. The fields must be covered by a MongoDB Search index.

Important

The $search aggregation pipeline stage is available for collections hosted on:

To learn more, see MongoDB Search.

For example, you can use $search to perform the following types of operations:

  • Searches to match text fields with various patterns.

  • Fuzzy matches to find terms with spelling variations.

  • Compound queries to combine multiple search conditions.

  • Relevance scoring to rank results.

  • Return snippets of matching text.

  • Vector searches to find documents using vector similarities.

For more details, see: