Couchbase preconditions
Last updated: July 13, 2026
Couchbase preconditions are extension-specific tags that check for the existence of Couchbase resources before executing a changeset. Use them inside a standard Liquibase <preConditions> block. In XML changelogs, all Couchbase precondition tags require the ext: namespace prefix.
Known limitations:
All Couchbase precondition tags require the
ext:namespace prefix in XML changelogs. Make sure your changelog header includes the Couchbase extension schema location.queryCustomCheckcompares the full query result againstexpectedResultJsonas an exact string match, including field names and value order.
Available preconditions
bucketExists
Checks whether a bucket with the specified name exists in the Couchbase cluster.
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The name of the bucket to check. | Yes |
scopeExists
Checks whether a scope exists within a bucket.
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The name of the bucket containing the scope. | Yes |
| String | The name of the scope to check. | Yes |
collectionExists
Checks whether a collection exists within a scope.
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The name of the bucket containing the scope. | Yes |
| String | The name of the scope containing the collection. | Yes |
| String | The name of the collection to check. | Yes |
documentExists
Checks whether a document with the specified key exists in a collection.
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 to check. | Yes |
| String | The document key to check for. | Yes |
doesIndexExist
Checks whether a named secondary query index exists on a collection.
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 to check. | Yes |
| String | The name of the secondary index to check for. | Yes |
doesPrimaryIndexExist
Checks whether a primary query index exists on a collection.
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 to check. | Yes |
| String | The name of the primary index to check for. | Yes |
queryCustomCheck
Runs a SQL++ query against the cluster and checks whether the result matches the expected JSON value.
Attribute | Type | Description | Required |
|---|---|---|---|
| String | The SQL++ (N1QL) query to execute. | Yes |
| String | The expected query result as a JSON string. The actual result must match exactly. | Yes |