# Upgrade the MongoDB Version

{% hint style="warning" %}
DBaaS supports MongoDB versions 6.0 and 7.0. At <code class="expression">space.vars.ionos\_cloud</code>, 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 %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/databases/mongodb/api/v1-api/modify-cluster-attributes/upgrade-the-mongodb-version.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
