Docs Home → Launch & Manage MongoDB → MongoDB Atlas
Run Atlas Search Queries
On this page
- View Query Guidance Template
- In Atlas, go to the Database Deployments page for your project.
- Go to the Atlas Search page for your cluster.
- View the query guidance template.
- Run Atlas Search Queries in the Search Tester
- Prerequisites
- Search Your Collection
- View, Edit, or Copy Query Syntax
- Run Atlas Search Queries in Compass, Drivers and
mongosh
You can run Atlas Search queries in the Search Tester, Compass, Drivers and
mongosh
. Atlas Search also provides query guidance in the Atlas UI.
Tip
Quickly try Atlas Search without needing an Atlas account, cluster, or collection, with the Atlas Search Playground. To learn more, see the documentation.
View Query Guidance Template
Atlas Search provides a sample compound query template with guidance. The template demonstrates how to build a compound query and the index definition for that query. For an example tutorial, see How to Run Atlas Search Compound Queries with Weighted Fields.
To view this query guidance template:
In Atlas, go to the Database Deployments page for your project.
If it is not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
If it is not already displayed, select your desired project from the Projects menu in the navigation bar.
If the Database Deployments page is not already displayed, click Database in the sidebar.
Run Atlas Search Queries in the Search Tester
The Search Tester feature in the Atlas Search tab allows you to:
Enter the term to search in the collection.
Run a
$search
,$searchMeta
, or$vectorSearch
query. By default, the Search Tester shows a simple wildcard query.View your Atlas Search query syntax, which you can then run in
mongosh
or MongoDB Compass.
For $search
queries, the Search Tester returns
the top 10 documents sorted based on relevance score. For $searchMeta
queries, the
Search Tester shows one meta document.
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
In Atlas, go to the Database Deployments page for your project.
If it is not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
If it is not already displayed, select your desired project from the Projects menu in the navigation bar.
If the Database Deployments page is not already displayed, click Database in the sidebar.
On the index you'd like to query, click the Query button on the righthand side of the card.
View, Edit, or Copy Query Syntax
Click Edit 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.
Copy Query Syntax
Click to copy the query syntax in JSON
format to your clipboard. You can run the copied query in
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 |