Couchbase mutateIn
Last updated: July 13, 2026
Performs sub-document mutations on documents in a Couchbase collection, allowing you to modify, insert, or remove specific fields within a document without replacing the entire document.
Known limitations:
INCREMENTandDECREMENToperations only work on numeric (Long) values.ARRAY_INSERT_UNIQUEthrows an error if the value already exists in the array.There is no automatic rollback support.
Available attributes
You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The name of the bucket containing the collection. | Yes |
| String | The name of the scope containing the collection. | Yes |
| String | The name of the collection containing the document(s). | Yes |
| Element | One or more sub-document mutation operations to perform. See nested tags below. | Yes |
| String | The key of a specific document to target. Mutually exclusive with | Yes* |
| String | An N1QL WHERE clause identifying documents to target. Mutually exclusive with | Yes* |
| String | A full SQL++ query for document selection. Mutually exclusive with | Yes* |
| String | ISO 8601 duration for document expiry after mutation (e.g., | No |
| Boolean | When | No |
| String | Controls how the mutated document is stored. | No |
Nested tags — mutateInSpec (within mutateInSpecs)
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The JSON path to the document field to target. Use an empty string to target the root document. | Yes |
| String | The mutation operation. | Yes |
| Element | The new value for the targeted path. Required for all operations except | No |
Nested tags — value (within mutateInSpec)
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The value content as a string, formatted according to the specified | Yes |
| String | The data type of | Yes |