# Upgrade the MongoDB Version

{% hint style="warning" %}
DBaaS supports MongoDB versions 6.0 and 7.0. At IONOS Cloud, we ensure that the MongoDB patch is up-to-date with the latest release for its current major version. Major version upgrades can be triggered manually, resulting in a brief cluster downtime.
{% endhint %}

{% hint style="info" %}
**Note:** To get the list of all available MongoDB versions, use [<mark style="color:blue;">API</mark>](https://api.ionos.com/docs/mongodb/v1/#tag/Metadata/operation/versionsGet).

```bash
curl --include \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    https://api.ionos.com/databases/mongodb/versions
```

To see which MongoDB Versions are supported for your cluster, use the following request:

```bash
curl --include \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    https://api.ionos.com/databases/mongodb/clusters/d02de413-d5af-4104-a6f9-3a3c2766ee61/versions
```

For more information, see [<mark style="color:blue;">API</mark>](https://api.ionos.com/docs/mongodb/v1/#tag/Clusters/operation/clustersVersionsGet).
{% endhint %}

To set a new MongoDB major version, send a `PATCH` request with the target `mongoDBVersion`.

## Endpoint

Use the following endpoint to set a new MongoDB version: `https://api.ionos.com/databases/mongodb/clusters/{clusterId}`

{% hint style="info" %}
**Note:** The sample UUID is `d02de413-d5af-4104-a6f9-3a3c2766ee61`.
{% endhint %}

## Request

```bash
curl --include \
    --request PATCH \
    --user "clientname@ionos.com:Mb2.r5oHf-0t" \
    --header "Content-Type: application/json" \
    --data-binary '{
      "properties": {
        "mongoDBVersion": "7.0"
      }
    }'
```

{% hint style="info" %}
**Note:**

* You cannot downgrade `mongoDBVersion` to a version older than your current version.
* MongoDB does not allow upgrading more than one version at a time. It is possible to trigger multiple major upgrades after one another sequentially, but it is not recommended.
* A cluster can only be restored from snapshots created for the same or the previous major version. It can lead to a situation where you can only restore from the last snapshot created directly before the upgrade when performing multiple upgrades in a row. It can lead to a situation where you can only restore from the last snapshot created directly before the upgrade when performing multiple upgrades in a row.
  {% endhint %}
