> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/databases/mongodb/overview/backup-and-recovery.md).

# Backup and Recovery

## Backups

**MongoDB Backups:** A cluster can have multiple snapshots. A snapshot is a copy of the data in the cluster at a certain time and is added during the following cases:

1. When a cluster is created, known as initial sync which usually happens in less than 24 hours.
2. After a restore.
3. Every 24 hours, a base snapshot is taken, and every Sunday, a full snapshot is taken.

Snapshots are retained for the last seven days; hence, recovery is possible for up to a week from the current date. You can restore from any snapshot as long as it was created with the same or older MongoDB patch version.

Snapshots are stored in an <code class="expression">space.vars.ionos\_cloud\_object\_storage</code> bucket in the same region as your database. Databases in regions where <code class="expression">space.vars.ionos\_cloud\_object\_storage</code> is not available is backed up to `eu-central-2`.

{% hint style="danger" %}
**Warning:** If you destroy a MongoDB cluster, all of its snapshots are also deleted.
{% endhint %}

## Offsite Backup

MongoDB Enterprise edition supports Offsite Backups, this allows backup data being stored in a location other than the deployed database cluster.

Available locations are `de`, `eu-south-2`, `eu-central-2`.

{% hint style="info" %}
**Info:** The location can only be set during cluster creation. Changes to the backup location of a provisioned cluster will result in unexpected behaviour.
{% endhint %}

## Request

```bash
curl --include \
    --request POST \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "metadata": {},
      "properties": {
        "edition": "enterprise",
        "backup": {
          "location": "de"
        },
        ...
    }' \
    https://api.ionos.com/databases/mongodb/clusters
```

## Recovery

Recovery is achieved via the restore jobs. A restore job is responsible to create and catalog a cluster restoration process. A valid snapshot reference is required for a restore job to recover the database. The API exposes available snapshots of a cluster.

There must be no other active restore job for the cluster to create a new one.

{% hint style="danger" %}
**Warning:** When restoring a database, it is advised to avoid connections to it until its restore job is complete and the cluster reaches `AVAILABLE` state.
{% endhint %}

## Point in time recovery

This feature is available only for enterprise clusters. The restoration of cluster here includes points in time and operations log (oplog) timestamps. A custom snapshot can be created for the exact oplog timestamp that you choose to restore the database cluster is possible with point in time recovery.

For more information on restoring database from backup by using the Cloud API, see [<mark style="color:blue;">Restore a Database</mark>](/cloud/databases/mongodb/api/v1-api/restore-a-database.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/databases/mongodb/overview/backup-and-recovery.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
