liveBook · Manning

Atlas Online Archive

As explained in MongoDB 8.0 in Action, Third Edition

Atlas Online Archive is a MongoDB Atlas capability that automatically moves infrequently accessed or historical collection data to lower-cost archival storage while retaining query access.

Atlas Online Archive moves infrequently accessed documents from an Atlas cluster to lower-cost cloud object storage. The archived data remains queryable without restoration, making archiving useful for historical analysis and retention needs. It is available for M10 and higher clusters. It is not a backup: keep a separate backup strategy for recovery from data loss or corruption. section 17.0 section 17.5

Table 17.1 Atlas archiving criteria

Criteria type

Archiving criteria

Federated database instance

Standard collection

Date-based archiving—A combination of a date field and number of days to retain data in the Atlas cluster. Data is archived when the current date surpasses the date field plus the specified days.

Custom query—Executes a specified query to determine which documents to archive

Archive-only instance—Allows querying of only the archived data

Combined instance—Allows querying of the live cluster and archived data

Time-series collection

Time-based archiving—A combination of a time field and a specified number of days to keep data in the Atlas cluster. Data is archived when the current time exceeds the specified time field by the designated days, hours, and minutes.

Archive-only instance—Permits queries on archived data only

Combined Instance—Enables querying of the live cluster and archived data

Remarks

Online Archive is available only for clusters that are M10 and higher.

Compare the available rules before creating an archive: standard collections support date-based rules or a custom query; time-series collections use a time field and retention interval. Both offer archive-only and combined query instances. section 17.1

An archiving job selects documents using the configured rule, copies them to object storage, then deletes them from the live cluster. Documents can briefly appear in both places during that transition. Archived data is read-only and is not synchronized with later changes to the cluster. Index date fields and expressions used by archiving queries; insufficient indexing triggers a warning. section 17.1.1 section 17.1.2

Check the operational costs before enabling an archive:

  • Archiving consumes cluster resources, including IOPS. A job writes at most 2 GB and processes up to 10,000 partitions; the next job starts five minutes after the current one completes. Check spare cluster capacity first. section 17.1.1
  • Federated and archive-only queries incur costs from scans, partition access and transfers. Set data-processing limits to halt new queries at a threshold, or enable termination of queries that exceed it. section 17.3 section 17.5
  • Direct writes to the archive and archiving from capped collections are unsupported. You can configure a Deletion Age Limit to remove archived data after a specified period. section 17.1.1 section 17.1.2

Query historical sales

Suppose a date-based rule archives sales whose saleDate is older than five days. In the demonstrated sample_supplies.sales collection, all 5,000 documents meet that rule. Use Connect in the Atlas Online Archive area to obtain a read-only federated connection string for live and archived collections under their existing names, or an archive-only string to query just the historical sales. section 17.3 section 17.1

To restore archived documents, first find the archive ID with `atlas clusters onlineArchive list`, then pause it with `atlas clusters onlineArchive pause` and verify its paused state. Create the required unique index on the destination fields, connect to the archive with `mongosh`, and run an aggregation with `$merge` into the destination Atlas collection. Confirm the destination has enough space; this method is not advised for large, heavily partitioned data sets of approximately 1 TB. section 17.4

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Details rule types, job limits, query connections, cost controls and restoration steps, without a full archive-creation walkthrough.
Examples
Uses archived sample_supplies.sales documents, federated and archive-only connection strings, and CLI and aggregation commands for restoration.
What it assumes
Assumes an Atlas cluster and collection; introduces the archive's storage and query model before using Atlas CLI and mongosh.
What you can do after
Operate/configure it: choose archiving criteria, query live and archived data, control query costs, and restore documents.
How it connects
Connects archiving to Atlas Data Federation, time-series collections, indexing, backups and aggregation `$merge`.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.