# Couchbase

Performs operations against Couchbase for each message, allowing you to store or delete data.

When inserting, replacing or upserting documents, each must have the `content` property set.

## Configuration

| Name          | Type     | Optional | Secret | Description                                                                                                                        |
| ------------- | -------- | -------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| url           | string   | no       | no     | Couchbase connection string.                                                                                                       |
| username      | string   | no       | no     | Username to connect to the cluster.                                                                                                |
| password      | string   | no       | yes    | Password to connect to the cluster.                                                                                                |
| bucket        | string   | no       | no     | Couchbase bucket.                                                                                                                  |
| collection    | string   | yes      | no     | Bucket collection. The value defaults to `"_default"`.                                                                             |
| transcoder    | string   | yes      | no     | Couchbase transcoder to use. The value defaults to `"legacy"`.                                                                     |
| timeout       | string   | yes      | no     | Operation timeout. The value defaults to `"15s"`.                                                                                  |
| id            | string   | no       | no     | Document id.                                                                                                                       |
| content       | string   | no       | no     | Document content.                                                                                                                  |
| operation     | string   | yes      | no     | Couchbase operation to perform. The value defaults to `"upsert"`.                                                                  |
| max_in_flight | int      | yes      | no     | The maximum number of messages to have in flight at a given time. Increase this to improve throughput. The value defaults to `64`. |
| batching      | batching | no       | no     | Allows you to configure a batching policy.                                                                                         |

### Batching

| Name      | Type   | Optional | Secret | Description                                                                                                                                                               |
| --------- | ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| count     | int    | yes      | no     | A number of messages at which the batch should be flushed. If `0` disables count based batching. The value defaults to `0`.                                               |
| byte_size | int    | yes      | no     | An amount of bytes at which the batch should be flushed. If `0` disables size based batching. The value defaults to `0`.                                                  |
| period    | string | yes      | no     | A period in which an incomplete batch should be flushed regardless of its size. The value defaults to `""`.                                                               |
| check     | string | yes      | no     | A [Bloblang query](/platform/1.14/connectors/bloblang.md) that should return a boolean value indicating whether a message should end a batch. The value defaults to `""`. |
