Command Palette

Search for a command to run...

Level 2 · 20 min

Atlas

MongoDB Atlas is the managed cloud service for MongoDB. Beyond hosting, Atlas provides Atlas Search (Lucene-based full-text search), automated backups with PITR, performance tooling, and serverless capabilities.

Atlas Search

Atlas Search is a full-text search engine built on Apache Lucene, tightly integrated with MongoDB. Unlike MongoDB's basic $text operator (which is limited and not recommended for production search), Atlas Search provides: relevance-based ranking (BM25), fuzzy matching, autocomplete, highlight, custom scoring, facets, synonyms, and language analyzers. Atlas Search indexes are defined separately from MongoDB indexes and maintained on dedicated Lucene processes co-located with the mongod. In aggregation pipelines, Atlas Search is accessed via the $search stage (must be first in the pipeline). The $searchMeta stage returns facet metadata without document hits. Lucene-powered Atlas Search is significantly more capable than $text but requires an Atlas cluster (not self-hosted).

Backup and PITR

$lookup performs a left outer join between the current collection and another collection in Atlas Search context. Atlas Search is a full-text search engine built on Apache Lucene, tightly integrated with MongoDB. Unlike MongoDB's basic $text operator (which is limited and not recommended for production search), Atlas Search provides: relevance-based ranking (BM25), fuzzy matching, autocomplete, highlight, custom scoring, facets, synonyms, and language analyzers. Atlas Search indexes are defined separately from MongoDB indexes and maintained on dedicated Lucene processes co-located with the mongod. In aggregation pipelines, Atlas Search is accessed via the $search stage (must be first in the pipeline). The $searchMeta stage returns facet metadata without document hits. Key insight from MongoDB: The Definitive Guide (3rd ed., Bradshaw, Brazil, Chodorow): the book draws a clear line between basic text indexes and Atlas Search: 'This type of text index should not be confused with the MongoDB Atlas Full-Text Search Indexes, which utilize Apache Lucene for additional text search capabilities.' Atlas backups use snapshot-based PITR: the oplog is applied to a base snapshot to replay all operations up to the desired restore point — exactly the same mechanism used for replica set replication, making PITR inherently consistent with the data model. The Atlas profiler default threshold matches the standalone profiler: queries exceeding 100ms are flagged by Performance Advisor.

Performance Advisor and Optimization

Atlas Performance Advisor analyzes the query profiler and suggests missing indexes — it identifies slow queries (> 100ms) and recommends the specific index that would improve them. Accept the suggestion to create the index directly from the UI. Atlas Query Insights provides an aggregated view of query performance over time, tracking slow query trends. The Atlas profiler captures queries exceeding a threshold (configurable). Online Archive automatically moves data older than a defined date to Atlas Data Lake — a cost-effective cold storage tier. Atlas Triggers run serverless functions on database events (insert, update, delete) — enabling event-driven architectures without external infrastructure.

Key Takeaways

  • Atlas Search uses Apache Lucene — the same engine as Elasticsearch. It provides relevance ranking, fuzzy matching, and autocomplete that basic $text cannot.
  • PITR (Point-in-Time Recovery) lets you restore to any second within the retention window. It works by replaying the oplog against a base snapshot.
  • Performance Advisor surfaces missing indexes automatically. It is the fastest path to finding index gaps in production without manually reading explain() on every slow query.

Code example

// Atlas Search in aggregation pipeline\ndb.products.aggregate([\n  {\n    $search: {\n      index: 'default',\n      text: {\n        query: 'laptop',\n        path: 'name',\n        fuzzy: {maxEdits: 1}\n      }\n    }\n  },\n  {$limit: 10},\n  {$project: {name: 1, price: 1, score: {$meta: 'searchScore}}}  \n])