Test and Run Atlas Search Queries
Test an Atlas Search Query
The Search Tester feature in the Search tab allows you to:
- Enter the term to search in the collection.
- Run a simple wildcard query.
- View your Atlas Search query syntax, which you can then run in
mongosh
or export to a programming language.
The Search Tester returns 10 documents that are assigned a high score based on relevance.
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, Copy, or Export Query Syntax
Click View Query Syntax to view your query syntax in JSON format.
You can copy your query syntax in JSON format or export your query syntax to a programming language. See View, Copy, or Export Query Syntax for more information.
Copy or export your query syntax.
You can copy the query syntax in JSON format or export your query syntax to a programming language.
Copy Query Syntax
Click to copy the query syntax in JSON
format to your clipboard. You can run the copied query in your
mongosh
after connecting to
your Atlas cluster.
Click Close to exit the View Query Syntax modal.
Run an Atlas Search Query
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 |