Navigation

$searchBeta (aggregation)

On this page

Special Offer

Want to try out Full Text Search on a cluster of your own? Use credit activation code MONGODB4DOT2 for $200 of Atlas credit. For information on redeeming Atlas credit, see Atlas Billing.

Definition

$searchBeta

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>: {
      <specification(s)>
    }
  }
}

Behavior

$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.