---
title: digitalocean_database_mongodb_config
description: Provides a virtual resource that can be used to change advanced configuration options for a DigitalOcean managed MongoDB database cluster.
product: Reference
url: https://docs.digitalocean.com/reference/terraform/reference/resources/database_mongodb_config/
last_updated: "2026-08-06"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# digitalocean_database_mongodb_config

Generated on 6 Aug 2026 from Terraform version [`v2.99.1`](https://github.com/digitalocean/terraform-provider-digitalocean/releases/tag/v2.99.1)

Provides a virtual resource that can be used to change advanced configuration options for a DigitalOcean managed MongoDB database cluster.

-> **Note** MongoDB configurations are only removed from state when destroyed. The remote configuration is not unset.

## Example Usage

```hcl
resource "digitalocean_database_mongodb_config" "example" {
  cluster_id                         = digitalocean_database_cluster.example.id
  default_read_concern               = "majority"
  default_write_concern              = "majority"
  transaction_lifetime_limit_seconds = 100
  slow_op_threshold_ms               = 100
  verbosity                          = 3
}

resource "digitalocean_database_cluster" "example" {
  name       = "example-mongodb-cluster"
  engine     = "mongodb"
  version    = "7"
  size       = "db-s-1vcpu-1gb"
  region     = "nyc3"
  node_count = 1
}
```

## Argument Reference

The following arguments are supported. See the [DigitalOcean API documentation](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_patch_config) for additional details on each option.

- `cluster_id` - (Required) The ID of the target MongoDB cluster.
- `default_read_concern` - (Optional) Specifies the default consistency behavior of reads from the database. Data that is returned from the query with may or may not have been acknowledged by all nodes in the replicaset depending on this value. Learn more [here](https://www.mongodb.com/docs/manual/reference/read-concern/).
- `default_write_concern` - (Optional) Describes the level of acknowledgment requested from MongoDB for write operations clusters. This field can set to either `majority` or a number`0...n` which will describe the number of nodes that must acknowledge the write operation before it is fully accepted. Setting to `0` will request no acknowledgement of the write operation. Learn more [here](https://www.mongodb.com/docs/manual/reference/write-concern/).
- `transaction_lifetime_limit_seconds` - (Optional) Specifies the lifetime of multi-document transactions. Transactions that exceed this limit are considered expired and will be aborted by a periodic cleanup process. The cleanup process runs every `transactionLifetimeLimitSeconds/2 seconds` or at least once every 60 seconds. *Changing this parameter will lead to a restart of the MongoDB service.* Learn more [here](https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.transactionLifetimeLimitSeconds).
- `slow_op_threshold_ms` - (Optional) Operations that run for longer than this threshold are considered slow which are then recorded to the diagnostic logs. Higher log levels (verbosity) will record all operations regardless of this threshold on the primary node. *Changing this parameter will lead to a restart of the MongoDB service.* Learn more [here](https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.slowOpThresholdMs).
- `verbosity` - (Optional) The log message verbosity level. The verbosity level determines the amount of Informational and Debug messages MongoDB outputs. 0 includes informational messages while 1…5 increases the level to include debug messages. *Changing this parameter will lead to a restart of the MongoDB service.* Learn more [here](https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-systemLog.verbosity).

## Attributes Reference

All above attributes are exported. If an attribute was set outside of Terraform, it will be computed.

## Import

A MongoDB database cluster’s configuration can be imported using the `id` the parent cluster, e.g.

```
terraform import digitalocean_database_mongodb_config.example 4b62829a-9c42-465b-aaa3-84051048e712
```