# mongodb

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: mongodb
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: caches/mongodb
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: caches/mongodb.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/caches/mongodb.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/caches/mongodb.md -->

**Type:** Cache ▼

[Cache](https://docs.redpanda.com/connect/components/caches/mongodb/)[Input](https://docs.redpanda.com/connect/components/inputs/mongodb/)[Output](https://docs.redpanda.com/connect/components/outputs/mongodb/)[Processor](https://docs.redpanda.com/connect/components/processors/mongodb/)

**Available in:** [Cloud](https://docs.redpanda.com/cloud-data-platform/develop/connect/components/caches/mongodb/%20%22View%20the%20Cloud%20version%20of%20this%20component%22), Self-Managed

Use a MongoDB instance as a cache.

Introduced in version 3.43.0.

#### Common

```yml
caches:
  mongodb:
    url: "" # No default (required)
    database: "" # No default (required)
    username: ""
    password: ""
    collection: "" # No default (required)
    key_field: "" # No default (required)
    value_field: "" # No default (required)
```

#### Advanced

```yml
caches:
  mongodb:
    url: "" # No default (required)
    database: "" # No default (required)
    username: ""
    password: ""
    app_name: benthos
    collection: "" # No default (required)
    key_field: "" # No default (required)
    value_field: "" # No default (required)
```

## [](#fields)Fields

### [](#app_name)`app_name`

The client application name.

**Type**: `string`

**Default**: `benthos`

### [](#collection)`collection`

The name of the target collection.

**Type**: `string`

### [](#database)`database`

The name of the target MongoDB database.

**Type**: `string`

### [](#key_field)`key_field`

The field in the document that is used as the key.

**Type**: `string`

### [](#password)`password`

The password to connect to the database.

> ⚠️ **CAUTION**
>
> This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see [Secrets](https://docs.redpanda.com/connect/configuration/secrets/).

**Type**: `string`

**Default**: `""`

### [](#url)`url`

The URL of the target MongoDB server.

**Type**: `string`

```yaml
# Examples:
url: mongodb://localhost:27017
```

### [](#username)`username`

The username to connect to the database.

**Type**: `string`

**Default**: `""`

### [](#value_field)`value_field`

The field in the document that is used as the value.

**Type**: `string`