> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: pre-8.2, 8.2-and-later
-->

# Manage Online Archives in Atlas

**Important:**

The feature described on this page is not currently supported on Atlas Infinite clusters during public preview. For the features supported in public preview, see [Public Preview Availability.](https://www.mongodb.com/docs/atlas/infinite/atlas-infinite-landing/#public-preview-availability)

**Important: Feature unavailable in Flex Clusters**

Flex clusters don't support this feature at this time. To learn more, see [Atlas Flex Limitations.](https://www.mongodb.com/docs/atlas/reference/flex-limitations.md#std-label-flex-cluster-limitations)

After you [configure](https://www.mongodb.com/docs/atlas/online-archive/configure-online-archive.md#std-label-config-online-archive) an online archive, you can do the following:

- [View](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-view-online-archive) your online archive

- [Edit](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-edit-online-archive) your online archive

- [Query](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-query-online-archive) your online archive

- [Delete](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-delete-online-archive) your online archive

**Important:**

Online Archive deletes documents from the cluster by using the `_id` and any shard keys. To ensure data loss does not occur, pause the archive before performing sharding operations, refrain from updating documents once they become eligible for archival, and ensure `_id` uniqueness across all documents in the application.

## Required Access

To view or query an online archive, you must have [`Project Read Only`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Read-Only) access or higher to the project.

To edit or delete an online archive, you must have [`Project Data Access Admin`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Data-Access-Admin) access or higher to the project.

## View Online Archives

**Important: Feature unavailable in Flex Clusters**

Flex clusters don't support this feature at this time. To learn more, see [Atlas Flex Limitations.](https://www.mongodb.com/docs/atlas/reference/flex-limitations.md#std-label-flex-cluster-limitations)

You can view the list of online archives for a cluster through the Atlas CLI, Atlas UI, and API (Application Programming Interface).

### Retrieve an Online Archive Using the Atlas CLI

To list all online archive for a cluster using the Atlas CLI, run the following command:

```sh

atlas clusters onlineArchives list [options]

```

To return the details for the online archive you specify using the Atlas CLI, run the following command:

```sh

atlas clusters onlineArchives describe <archiveId> [options]

```

To learn more about the syntax and parameters for the previous commands, see the Atlas CLI documentation for [atlas clusters onlineArchives list](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-clusters-onlineArchives-list/) and [atlas clusters onlineArchives describe.](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-clusters-onlineArchives-describe/)

**See also: Related Links**

- [Install the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/install-atlas-cli/)

- [Connect to the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/connect-atlas-cli/)

### Retrieve an Online Archive Using the API

To retrieve an online archive through the API (Application Programming Interface), send a `GET` request to the [onlineArchives](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-online-archive) endpoint with the unique ID of the online archive to retrieve. To learn more about the API (Application Programming Interface) syntax and options, see [API.](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getgroupclusteronlinearchive)

### Retrieve All Online Archives for a Cluster Using the API

To retrieve all the online archives configured for a cluster using the API (Application Programming Interface), send a `GET` request to the [onlineArchives](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-online-archive) endpoint for the cluster. To learn more about the syntax and options, see [API.](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listgroupclusteronlinearchives)

### View Online Archives in the UI

To view the list of Online Archives:

1. In Atlas, go to the Clusters page for your project.

   If it's not already displayed, select the organization that contains your desired project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

   In the sidebar, click Clusters under the Database heading.

   The [Clusters](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters) page displays.

2. Go to the Online Archive page for your cluster.

   In the sidebar, click Online Archive.

   The [Online Archive](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters%2FonlineArchive%2F%3Ccluster%3E) page displays.

The page displays the online archives for the cluster. For each online archive, you can see the following information:

**Note:**

The values for the new metrics available with the release on June 7, 2023 display in the Atlas UI only for online archives created after the release on the Date Match field. If you create a time series Online Archive, or have a preexisting online archive after the release date, Atlas displays `N/A` instead of the metric value.

| Column Name | Description |
| --- | --- |
| Status | Status of the online archive. Value can be one of the following: PendingIndicates documents are queued for archive, but archiving has not yet started.ArchivingIndicates archiving has started. In this state, the documents that meet the criteria for archiving are being archived.IdleIndicates online archive is waiting for the next archival [job](https://www.mongodb.com/docs/atlas/online-archive/overview.md#std-label-adf-oa-performance-expectations) to start.PausingIndicates that you have requested to pause archiving. In this state, Atlas is finishing the running archiving operation and therefore, Atlas has not yet put archiving on hold. The online archive transitions to the `Paused` state when the running archiving operation finishes.PausedIndicates archiving has been temporarily stopped. In this state, previously archived documents continue to be available on the cloud object storage for querying, but the specified archiving operation on the active cluster is put on hold and additional documents are not archived. You can resume archiving for paused archives at any time.OrphanedIndicates collection associated with an active or paused online archive was deleted or resharded. Atlas will not automatically delete the archived data. You must manually [delete](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-delete-online-archive) the orphaned online archive. If your collection was resharded, you can [create](https://www.mongodb.com/docs/atlas/online-archive/configure-online-archive.md#std-label-config-online-archive) another online archive for the same database, collection, and fields as the deleted online archive if there is no other online archive for the same database, collection, and fields in the `Active` state.DeletedIndicates online archive was deleted. When you delete an online archive, associated archived documents are removed from the cloud object storage. |
| Actions | Operations that you can perform on the Online Archive. |
| Archive Field | Date field based on which documents are archived. |
| Custom Criteria | Custom JSON (Javascript Object Notation) filter. You can scroll in this code component. Click the icon to expand the view to see the complete custom criteria. |
| Age Limit | Number of days used to qualify documents for archiving. |
| Deletion Age Limit | Number of days after which to delete the data in the archive. |
| Total Data Archived | Uncompressed data size stored in the archive. Hover to view the number of documents in the archive. Metric available only for new Online Archives. |
| Last Archived Run | Start date and timestamp when the archive was last run. Hover to view the last five jobs. Each job appears listed with its start date, start time, duration of time to archive, number of documents, and size. |
| Partition Fields | Other commonly used query fields used for partitioning data on the cloud object storage. |
| Schedule | Archiving window cadence. Values include: - `Monthy on <Day_Number>` - `Weekly on <Day_Name>` - `Daily` Hover to view the next archiving window. |
| Min Date Field | Minimum date value of all documents in the archive. Metric available only for new Online Archives on Atlas Data Federation. |
| Max Date Field | Maximum date value of all documents in the archive. Metric available only for new Online Archives on Atlas Data Federation. |

## View Online Archive Performance Metrics

To view metrics for the Online Archives in the Atlas UI:

1. In Atlas, go to your federated database instance for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Data Federation under the Services heading.

   The [Data Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2FdataFederation) page displays.

2. Review the metrics.

   The page displays the following metrics for each federated database instance under the Online Archive Federated Database Instances section:

   | Queries Executed / Month | Number of queries executed (cumulative) in the current calendar month. Atlas refreshes this value every 5 minutes. |
   | --- | --- |
   | Data Processed / Month | Amount of [data processed](https://www.mongodb.com/docs/atlas/billing/data-federation.md#std-label-atlas-data-federation-billing) in the current calendar month. Atlas refreshes this value every 5 minutes. |
   | Data Returned / Month | Amount of [data returned](https://www.mongodb.com/docs/atlas/billing/data-federation.md#std-label-atlas-data-federation-billing) in the current calendar month. Atlas refreshes this value every 5 minutes. |
   | Last Archive Run | Date and time when Atlas last ran the archive job to archive data. |

## Edit an Archiving Rule

**Important: Feature unavailable in Flex Clusters**

Flex clusters don't support this feature at this time. To learn more, see [Atlas Flex Limitations.](https://www.mongodb.com/docs/atlas/reference/flex-limitations.md#std-label-flex-cluster-limitations)

You can modify the number of days to keep data on the Atlas cluster (the Age Limit) or the custom JSON (Javascript Object Notation) query used to select documents for archiving from the Atlas UI and API (Application Programming Interface). You can't change the archiving criteria from Date Match to Custom Filter, or vice versa.

### Edit an Archiving Rule Through the Atlas CLI

To update an online archive for a cluster using the Atlas CLI, run the following command:

```sh

atlas clusters onlineArchives update <archiveId> [options]

```

To learn more about the command syntax and parameters, see the Atlas CLI documentation for [atlas clusters onlineArchives update.](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-clusters-onlineArchives-update/)

### Edit an Archiving Rule Through the API

To edit an online archive through the API (Application Programming Interface), send a `PATCH` request to the [onlineArchives](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-online-archive) endpoint with the unique ID of the online archive to update. To learn more about the API (Application Programming Interface) syntax and options, see [API.](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-updategroupclusteronlinearchive)

### Edit an Archiving Rule Through the UI

To edit an online archive, in your Atlas UI:

1. In Atlas, go to the Clusters page for your project.

   If it's not already displayed, select the organization that contains your desired project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

   In the sidebar, click Clusters under the Database heading.

   The [Clusters](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters) page displays.

2. Go to the Online Archive page for your cluster.

   In the sidebar, click Online Archive.

   The [Online Archive](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters%2FonlineArchive%2F%3Ccluster%3E) page displays.

3. Click the ellipsis (`...`) in the Actions column for the online archive to display the list of allowed actions. You can:

   - Pause Archiving (only if state is Active)

   - Edit Archive

   - Delete Archive

   - Resume Archiving (only if state is Paused)

4. Select Edit Archive from the dropdown to make changes to your archiving rule, the number of days to keep archived data, and the time window for running data archiving jobs.

   You can change the archiving criteria and the number of days after which to delete archived data.

   - To edit Date Match criteria, modify the number of days Atlas stores data on the active Atlas cluster in the Archival Age Limit section.

   - To edit Custom Criteria, enter a valid JSON (Javascript Object Notation) filter to select the documents for archiving.

     **Note:**

     Atlas uses the specified query with the [db.collection.find(query)](https://www.mongodb.com/docs/manual/reference/method/db.collection.find/) command. Custom queries do not support JavaScript expressions. Also, you can't pass an empty document `{}` to return all documents.

   - To modify the number of days after which Atlas deletes archived data, enter or modify the number of days in the Deletion
     Age Limit section. You can specify between `7` and `9125` days, or leave the field empty to disable the data expiration rule. It takes 24 hours for this change to take effect.

   - To modify the scheduled time for data archiving jobs, make changes to any of the following:

     - Frequency. You can choose to run the job every day, on a specific day of the week, or on a specific date every month. If you wish to archive on the 29th, 30th, or 31st of every month, Atlas doesn't run the archiving job for those months that don't include those dates.

     - Time window. Select the period of time during which you want Atlas to run the data archiving job. You must specify a minimum of two hours.

     You can also disable the schedule by toggling Schedule
     Archive Window. If you disable the schedule, Atlas reverts to the default schedule and [runs the archiving job periodically.](https://www.mongodb.com/docs/atlas/online-archive/overview.md#std-label-adf-oa-performance-expectations)

     Atlas starts using the new data archiving schedule immediately after you change it. However, if an archiving job is currently running, Atlas doesn't interrupt the running job and the setting takes effect after the job completes.

5. Click Save for the changes to take effect.

   **Note:**

   It takes 24 hours for changes to Deletion Age Limit to take effect.

### Edit the Partition on the Cloud Object Store

You can't modify the partition fields or structure from the Atlas UI or API (Application Programming Interface). However, you can manually migrate the data from the cloud object storage using [`$merge`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge.md#mongodb-pipeline-pipe.-merge), use [`$merge`](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge.md#mongodb-pipeline-pipe.-merge) to rehydrate data back to Atlas cluster, [delete](https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive.md#std-label-delete-online-archive) the online archive, and then create a new online archive for the collection with the desired partition fields and structure.

## Query Online Archive

You can run queries against your archived data.

**Note:**

Atlas Data Federation uses columnar storage that doesn't preserve the order of fields within documents. Therefore, Atlas Data Federation doesn't support queries that are field-order sensitive against your archived data.

### Connection String

To run queries, you must first connect to your Online Archive. Your [cluster connection string](https://www.mongodb.com/docs/search/self-managed/current/connection/connect-to-search.md#std-label-mongot-connect) allows you to only query data in your Atlas cluster. To query your Online Archive, you must use one of the following:

- [Connect to Online Archive and Cluster](https://www.mongodb.com/docs/atlas/online-archive/connect-to-online-archive.md#std-label-connect-online-archive-cluster-atlas-ui) - this read-only connection string allows you to read data directly from the live cluster. This impacts available resources for IOPS (Input/Output Operations per Second), and from your Online Archive.

- [Connect to Online Archive](https://www.mongodb.com/docs/atlas/online-archive/connect-to-online-archive.md#std-label-connect-online-archive-atlas-ui) - this read-only connection string allows you to read data from the Online Archive only and doesn't affect cluster resources.

### Performance Considerations

In general, your queries against archived data are much slower than your queries against data on the Atlas cluster. When you query data in your cluster and Online Archive through the federated connection string:

- Blocking queries, such as sorts that consume and process all input documents to the sort operation before returning results, have performance characteristics associated with the slowest storage, the archive, being queried. The sort operations require all data from the sources being queried before returning the results.

- Streaming queries, such as finds, have performance characteristics associated with the highest performing storage, the Atlas cluster, being queried. Atlas returns the results as soon as they are available, which means returning results from the archive takes longer than returning results from the Atlas cluster.

### Query Price

For your federated and archive-only queries, you incur costs for the following items.

#### Data Scan

During data scan, Atlas processes data from both the cluster and the archive. Atlas runs as much of the query on the cluster as it can to minimize the amount of data it needs to scan. For example, for a `match` query that specifies a specific value, Atlas only retrieves documents with the specified value from the cluster. Atlas then combines the retrieved documents with the archived data and returns.

For blocking queries that need to access all data stored in the underlying cluster, Atlas retrieves all data. For example, for a `sort` (with no `match`), Atlas retrieves all data from the cluster and archive to be sorted.

#### Data Access

MongoDB charges a fee for each partition that you query in the archive. If your query requires querying specific partitions, MongoDB downloads the partitions and each downloaded partition corresponds to a single access.

#### Data Seek

To find partitions based on the query and query fields, Atlas runs operations on the archive. Each such operation that Atlas runs finds up to 1000 partitions. Atlas runs the minimum number of required operations to find the partitions required to satisfy the query. For example, if your query requires 100 partitions that are covered in your query fields, Atlas runs only one operation to satisfy the query.

#### Data Transfer

Data that is transferred to the federated infrastructure incurs data transfer costs.

## Delete an Online Archive

**Important: Feature unavailable in Flex Clusters**

Flex clusters don't support this feature at this time. To learn more, see [Atlas Flex Limitations.](https://www.mongodb.com/docs/atlas/reference/flex-limitations.md#std-label-flex-cluster-limitations)

You can delete an online archive through the Atlas CLI, Atlas UI, and API (Application Programming Interface). You delete the online archive manually. Five days after you delete an online archive, Atlas automatically deletes all the files and metadata on the online archive storage. After Atlas deletes this data, you can't restore it.

If you drop a [database](https://www.mongodb.com/docs/manual/reference/command/dropDatabase/) or [collection](https://www.mongodb.com/docs/manual/reference/command/drop/) configured for online archive, the data from the collection, if archived, continues to be available on the cloud object storage. You incur costs for storage on the cloud object storage. Alternatively, if you [delete the cluster](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-deletegroupcluster), Atlas deletes all the online archives configured for the cluster. This also deletes any archived data from the cloud object storage.

If you delete all the online archives, you also delete the federated database instance and you create a new federated database instance when you create an online archive again.

After you delete an online archive, its state moves to `Deleted`. You can create another online archive for the same database, collection, and fields as the deleted online archive if there is no other online archive for the same database, collection, and fields in the `Active` state.

### Delete an Online Archive Through the Atlas CLI

To delete an online archive for a cluster using the Atlas CLI, run the following command:

```sh

atlas clusters onlineArchives delete <archiveId> [options]

```

To learn more about the command syntax and parameters, see the Atlas CLI documentation for [atlas clusters onlineArchives delete.](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-clusters-onlineArchives-delete/)

### Delete an Online Archive from the UI

To delete an online archive, in your Atlas UI:

1. In Atlas, go to the Clusters page for your project.

   If it's not already displayed, select the organization that contains your desired project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

   In the sidebar, click Clusters under the Database heading.

   The [Clusters](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters) page displays.

2. Go to the Online Archive page for your cluster.

   In the sidebar, click Online Archive.

   The [Online Archive](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters%2FonlineArchive%2F%3Ccluster%3E) page displays.

3. Click the ellipsis (`...`) in the Actions column for the online archive to display the list of allowed actions. You can:

   - Pause Archiving (only if state is Active)

   - Edit Archive

   - Delete Archive

   - Resume Archiving (only if state is Paused)

4. Select Delete Archive from the ellipsis menu to display the Delete Online Archive confirmation window.

5. Enter the name of the online archive to delete and click Delete.

### Delete an Online Archive Through the API

To delete an online archive through the API (Application Programming Interface), send a `DELETE` request to the [onlineArchives](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-online-archive) endpoint with the unique ID of the online archive to delete. To learn more about the syntax and options, see [API.](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-deletegroupclusteronlinearchive)

### Remove Time Series Buckets Marked for Archival

When Online Archive archives a [time series collection](https://www.mongodb.com/docs/manual/core/timeseries-collections/), it first sets the internal `control.closed` field to `true` on each bucket that it marks for archival. After this field is set, the time series collection doesn't allow writes to the bucket. Inserts that would target the bucket write to another bucket or open a new one. Updates and deletes through the time series collection ignore the bucket.

If you delete the online archive before Online Archive removes these buckets from the cluster, the buckets remain on the cluster. Delete operations on the time series collection return a `deletedCount` of `0` for the documents that these buckets contain.

To remove these buckets, run a delete operation directly against the buckets. To run this operation, your database user must have the [`readWriteAnyDatabase`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readWriteAnyDatabase) role. The method depends on your MongoDB version:

- For MongoDB versions earlier than 8.2, run the delete on the `system.buckets.<collection>` collection.

- For MongoDB 8.2 and later, run the [`delete`](https://www.mongodb.com/docs/manual/reference/command/delete.md#mongodb-dbcommand-dbcmd.delete) command on the time series collection with the `rawData: true` option.

**Warning:**

This procedure permanently deletes data from your cluster. Online Archive might not have copied these buckets to the online archive before you deleted it. Before you delete the buckets, confirm that the data exists in a backup or in your online archive, and verify that the filter matches only the buckets that you intend to delete.

1. Identify the buckets to delete.

   Run a query with the same filter that you plan to use for the delete operation, and review the results. Replace `<database>`, `<collection>`, and `<timeField>` with your values, and set `cutoff` to the date before which to delete buckets.

   ```javascript
   const cutoff = ISODate("2026-03-01T00:00:00Z");
   db.getSiblingDB("<database>")
     .getCollection("system.buckets.<collection>")
     .find({
       "control.closed": true,
       "control.max.<timeField>": { $lte: cutoff }
     })
     .itcount()
   ```

2. Delete the buckets.

   ### Earlier than 8.2

   ```javascript
   const cutoff = ISODate("2026-03-01T00:00:00Z");
   db.getSiblingDB("<database>")
     .getCollection("system.buckets.<collection>")
     .deleteMany({
       "control.closed": true,
       "control.max.<timeField>": { $lte: cutoff }
     })
   ```
