$searchBeta (aggregation)

On this page



Atlas Search queries take the form of an aggregation pipeline stage. The $searchBeta stage performs a full-text search on the specified field or fields which must be covered by an Atlas Search index.

A $searchBeta pipeline stage has the following prototype form:

  $searchBeta: {
    <operator>: {


$searchBeta must be the first stage of any pipeline it appears in. $searchBeta cannot be used in:

The $searchBeta stage has the following operators:

Operator Description
term Unanalyzed search.
text Analyzed search.
phrase Analyzed search.
compound Combines other operators into a single query.
span Finds text search matches within specified regions of a text field.
exists Tests for the presence of a specified field.
near Finds search matches near a specified number or date.
range Finds search matches within a specific numeric or date range.
wildcard Finds search matches using special characters in the query string that can match any character.
regex Interprets the query field as a regular expression.