For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

MongoDB Search Quick Start

Get started with MongoDB Search by creating a search index, running a query, and processing the results. Select your deployment type, interface, and language to view the appropriate procedure.

A MongoDB Search index is a data structure that categorizes data in an easily searchable format. It maps terms with documents that contain those terms to enable fast retrieval of documents at query-time.

You must configure a MongoDB Search index to query data using MongoDB Search. We recommend that you index the fields that you regularly use to sort or filter your data.

To learn more, see Supported Clients.

In this section, you create a MongoDB Search index on the sample movies collection.

MongoDB Search queries take the form of an aggregation pipeline stage. You use MongoDB Search primarily with the $search stage, which must be the first stage in the query pipeline. You can also use this stage in conjunction with other stages in your pipeline.

When you run a MongoDB Search query, MongoDB Search uses the search index to locate and retrieve relevant data from the collection. MongoDB Search also provides the $searchMeta stage, multiple sub-pipelines, and several query operators and collectors that you can use to further refine your search results.

To learn more, see Queries and Indexes.

In this section, you run queries against the indexed collection.

You can use MongoDB Search to run autocomplete and partial queries that return results for partial words. This helps you retrieve results with increasing accuracy as more characters are entered in your application's search field. You must index the fields as the MongoDB Search autocomplete type to use the autocomplete operator.

To get started, see How to Run Autocomplete and Partial Match MongoDB Search Queries.

You can use MongoDB Search to run facet queries that group search results by string, date, or numeric values. You must create an index with a facet definition to use the facet (MongoDB Search Operator) collector.

To get started, see How to Use Facets with MongoDB Search.

Use the MongoDB Search Playground. to try different MongoDB Search features by configuring search indexes and running queries without an Atlas account, cluster, or collection.

To learn more, see MongoDB Search Playground.

To learn more about MongoDB Search, you can take Unit 1 of the Atlas Search Course on MongoDB University. The 2.25 hour unit includes an overview of MongoDB Search and lessons on how to create MongoDB Search indexes, use $search with different operators, and generate search facets.

You can also watch the following videos to learn more about MongoDB Search:

Watch an overview of Atlas Search and how to get started.

Watch an overview of Atlas and MongoDB Search and get started setting up MongoDB Search for your data. The video demonstrates how to load sample data on your cluster, create a MongoDB Search index, and run a sample query using Search Tester and Data Explorer.

Duration: 10 Minutes

Watch a video that demonstrates how to configure an Atlas Search index and run queries.

Follow along with the following video to learn how to configure your MongoDB Search index and run queries from your application.

Duration: 7 Minutes

Watch a video tutorial that demonstrates a demo application that uses Atlas Search.

Follow along with the following video tutorial walk-through that demonstrates how to build MongoDB Search queries for a Restaurant Finder demo application, which is also available at www.atlassearchrestaurants.com.

Duration: 20 Minutes