# Increase MongoDB Cluster Shards

DBaaS allows you to increase the number of shards for MongoDB Enterprise sharded clusters. An increased shard count increases the overall storage of the cluster.

{% hint style="info" %}
**Note:** We recommend you to review the [<mark style="color:blue;">Considerations</mark>](https://www.mongodb.com/docs/manual/tutorial/add-shards-to-shard-cluster/#considerations) before adding shards.
{% endhint %}

To increase the number of shards, send a `PATCH` request with the new `shards` count.

## Endpoint

Use the following endpoint to request the new instances count: `https://api.ionos.com/databases/mongodb/clusters/{clusterId}`

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

* The sample cluster UUID is `d02de413-d5af-4104-a6f9-3a3c2766ee61`.
* You can increase the number of shards to a maximum of 100.
  {% endhint %}

## Request

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

## Response

```json
{
  "type": "cluster",
  "id": "d02de413-d5af-4104-a6f9-3a3c2766ee61",
  "metadata": {
    "state": "BUSY",
    "health": "HEALTHY",
    "createdDate": "2020-12-10T12:37:50.000Z",
    "createdBy": "clientname@ionos.com",
    "createdByUserId": "012342f-411f-1eeb-9d07-046c59cc737e"
  },
  "properties": {
    "displayName": "Represents database name",
    "location": "de/fkb",
    "connections": [
      {
        "datacenterId": "b72ebcf5-6158-4ddb-8f65-31b20d82b6c7",
        "lanId": "2",
        "cidrList": [
          "10.1.1.3/24",
          "10.1.1.4/24",
          "10.1.1.5/24"
        ]
      }
    ],
    "mongoDBVersion": "6.0",
    "instances": 3,
    "maintenanceWindow": {
      "dayOfTheWeek": "Thursday",
      "time": "08:53:15"
    },
    "connectionString": "mongodb+srv://m-65f4a879f126e3c4.mongodb.de-fra.ionos.com",
    "backup": {},
    "edition": "enterprise",
    "cores": 1,
    "ram": 2048,
    "storageSize": 10240,
    "storageType": "SSD Standard",
    "shards": 3,
    "biConnector": {
      "enabled": false
    },
    "type": "sharded-cluster"
  }
}
```

The `PATCH` example modifies a previously created sharded cluster and sets the number of shards to three.

New shards added this way are created by provisioning new servers and adding them to the sharded cluster. Each shard has the number of servers provided by the instances field. Sharded collections' data will then be distributed to the new shards. For more information, see [<mark style="color:blue;">Balancer Internals</mark>](https://www.mongodb.com/docs/manual/core/sharding-balancer-administration/#std-label-sharding-internals-balancing).

{% hint style="info" %}
**Note:** Decreasing shards is currently not possible.
{% 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/increase-mongodb-cluster-shards.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.
