> 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/nodejs/dbaas-mongodb/api/clustersapi.md).

# ClustersApi

All URIs are relative to *<https://api.ionos.com/databases/mongodb>*

| Method                                    | HTTP request                     | Description         |
| ----------------------------------------- | -------------------------------- | ------------------- |
| [**clustersDelete**](#clustersdelete)     | **DELETE** /clusters/{clusterId} | Delete a Cluster    |
| [**clustersFindById**](#clustersfindbyid) | **GET** /clusters/{clusterId}    | Get a cluster by id |
| [**clustersGet**](#clustersget)           | **GET** /clusters                | Get Clusters        |
| [**clustersPatch**](#clusterspatch)       | **PATCH** /clusters/{clusterId}  | Patch a cluster     |
| [**clustersPost**](#clusterspost)         | **POST** /clusters               | Create a Cluster    |

## clustersDelete

> clustersDelete(clusterId)

Delete a Cluster

Deletes a MongoDB cluster.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-mongo');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.ClustersApi(config);
// Delete a Cluster
api_instance
  .clustersDelete({
    clusterId: clusterId_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type       | Description                   | Notes                   |
| ------------- | ---------- | ----------------------------- | ----------------------- |
| **clusterId** | **string** | The unique ID of the cluster. | \[default to undefined] |

### Return type

[**ClusterResponse**](/cloud/nodejs/dbaas-mongodb/models/clusterresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## clustersFindById

> clustersFindById(clusterId)

Get a cluster by id

Get a cluster by id.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-mongo');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.ClustersApi(config);
// Get a cluster by id
api_instance
  .clustersFindById({
    clusterId: clusterId_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type       | Description                   | Notes                   |
| ------------- | ---------- | ----------------------------- | ----------------------- |
| **clusterId** | **string** | The unique ID of the cluster. | \[default to undefined] |

### Return type

[**ClusterResponse**](/cloud/nodejs/dbaas-mongodb/models/clusterresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## clustersGet

> clustersGet(opts)

Get Clusters

Retrieves a list of MongoDB clusters.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-mongo');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.ClustersApi(config);
// Get Clusters
api_instance
  .clustersGet({
    limit: 100,
    offset: 200,
    filterName: filterName_example
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name           | Type       | Description                                                                                                                                                        | Notes                              |
| -------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
| **limit**      | **number** | The maximum number of elements to return. Use together with \&#39;offset\&#39; for pagination.                                                                     | \[optional]\[default to 100]       |
| **offset**     | **number** | The first element to return. Use together with \&#39;limit\&#39; for pagination.                                                                                   | \[optional]\[default to 0]         |
| **filterName** | **string** | Response filter to list only the MongoDB clusters that contain the specified name. The value is case insensitive and matched on the \&#39;displayName\&#39; field. | \[optional]\[default to undefined] |

### Return type

[**ClusterList**](/cloud/nodejs/dbaas-mongodb/models/clusterlist.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## clustersPatch

> clustersPatch(clusterId, patchClusterRequest)

Patch a cluster

Patch attributes of a MongoDB cluster.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-mongo');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.ClustersApi(config);
// Patch a cluster
api_instance
  .clustersPatch({
    clusterId: clusterId_example,
    patchClusterRequest: patchClusterRequest_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                    | Type                                                                                                                            | Description                                   | Notes                   |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ----------------------- |
| **clusterId**           | **string**                                                                                                                      | The unique ID of the cluster.                 | \[default to undefined] |
| **patchClusterRequest** | [**PatchClusterRequest**](https://github.com/ionos-cloud/sdk-nodejs-dbaas-mongo/blob/master/docs/models/PatchClusterRequest.md) | Part of the cluster which should be modified. |                         |

### Return type

[**ClusterResponse**](/cloud/nodejs/dbaas-mongodb/models/clusterresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## clustersPost

> clustersPost(createClusterRequest)

Create a Cluster

Creates a new MongoDB cluster.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-mongo');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.ClustersApi(config);
// Create a Cluster
api_instance
  .clustersPost({
    createClusterRequest: createClusterRequest_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                     | Type                                                                                   | Description                | Notes |
| ------------------------ | -------------------------------------------------------------------------------------- | -------------------------- | ----- |
| **createClusterRequest** | [**CreateClusterRequest**](/cloud/nodejs/dbaas-mongodb/models/createclusterrequest.md) | The cluster to be created. |       |

### Return type

[**ClusterResponse**](/cloud/nodejs/dbaas-mongodb/models/clusterresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json


---

# 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/nodejs/dbaas-mongodb/api/clustersapi.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.
