Use the following recommended best practices to determine whether to
refactor your applications that use MongoDB
$regex or migrate your applications to Atlas Search
$search. The following table shows how MongoDB
$text, and Atlas Search
address your application's requirements.
If your application requires...
Datastore to respect write concerns
Cluster optimized for write performance
Atlas Search indexes don't degrade cluster write performance.
Searching through large data sets
Atlas Search uses an inverted index, which enables fast document retrieval at very large scales.
Case-insensitive text search
Highlighting result text
Atlas Search highlighting allows you to contextualize the documents in the results, which is essential for natural language queries.
Geospatial-aware search queries
$regex and Atlas Search
geospatial parameters differently. In MongoDB, lines between
coordinates are spherical, which is well-suited for coordinates
for long distance such as air flight. Atlas Search uses Lucene, which
draws a straight line between coordinates and is well-suited
for short distance. To learn more, see
How to Run an Atlas Search Compound Geo JSON Query.
On-premises or local deployment
Atlas Search is unavailable for on-premise or local deployment. Atlas Search is only available for data on the Atlas cluster.
Autocompletion of search queries
For autocomplete of characters (nGrams), Atlas Search
To learn more, see How to Use Autocomplete with Atlas Search.
Fuzzy matching on text input
Filtering based on multiple strings
Atlas Search compound supports filtering based on more than 10 strings.
Relevance score sorted search
Atlas Search uses the BM25 algorithm for determining the search relevance score of documents. It supports advanced configuration through
boost expressions like
multiply and gaussian decay, as well as analyzers, search
operators, and synonyms. To learn more, see
How to Run Atlas Search Compound Queries with Weighted Fields.
Atlas Search doesn't support partial indexing.
Single compound index on arrays
Atlas Search term indexes are intersected in a single Atlas Search index and eliminate the need for compound indexes for filtering on arrays.
Faceting for counts
Atlas Search supports custom analyzers to suit your specific indexing requirements. For example, you can index and search email addresses and HTTP or HTTPS URLs using custom analyzers. To learn more, see How to Define a Custom Analyzer and Run an Atlas Search Diacritic-Insensitive Query.
Searching phrases or multiple words
Atlas Search phrase operator supports searching for a sequence of terms.