$searchBeta (aggregation)

On this page



Full Text 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 a Full Text 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.
search Full-text 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.