Run Atlas Search Queries
On this page
Run Atlas Search Queries in the Search Tester
The Search Tester feature in the Search tab allows you to:
Enter the term to search in the collection.
Run a
$search
query. By default, the Search Tester uses a simple wildcard query.View your Atlas Search query syntax, which you can then run in
mongosh
or MongoDB Compass.
The Search Tester returns the top 10 documents sorted based on relevance score.
Limitations
The Search Tester does not support faceted searches and the $searchMeta
aggregation pipeline
stage.
Prerequisites
To use the Search Tester in the Atlas UI, you must have the following:
An Atlas cluster running MongoDB version 4.2 or higher.
Atlas Search index on your collection in the Atlas cluster.
Search Your Collection
View, Edit, or Copy Query Syntax
Click Edit $search Query to view your query syntax in JSON format.
Edit or copy your query syntax.
You can edit or copy the query syntax in JSON format.
Edit Query Syntax
You can update the $search
query in the Search
Editor and test it by clicking the Search
button.
Important
When you finish editing your query, be sure to copy it. Once you click Close Search Editor, the Atlas UI discards your changes.
Copy Query Syntax
Click to copy the query syntax in JSON
format to your clipboard. You can run the copied query in your
mongosh
or MongoDB Compass after connecting to
your Atlas cluster.
Run Atlas Search Queries in Compass, Drivers and mongosh

To run a Atlas Search query, you must have the following:
An Atlas cluster running MongoDB version 4.2 or higher.
Atlas Search index on your collection in the Atlas cluster.
A connection to the client you want to use to run the query.
The Step 2: Run Atlas Search Queries page demonstrates how to connect to
your Atlas cluster and run $search
queries against the
sample_mflix.movies
collection using the following clients. To learn
more, select a client using the Select your language drop-down menu
on the Step 2: Run Atlas Search Queries page.
Client | Steps |
---|---|
MongoDB Compass |
To learn more, see Aggregation Pipeline Builder. |
Drivers |
To learn more about running
|
MongoDB Shell |
To learn more about running |