DROP BUCKET
- reference
- Couchbase Server 8.0
The DROP BUCKET statement enables you to delete a bucket.
Purpose
Use the DROP BUCKET statement to permanently delete an existing bucket from your Couchbase cluster. Dropping a bucket deletes all data in the bucket, including documents, scopes, and collections. It also deletes all associated indexes, metadata, and other bucket resources.
This operation is irreversible, so use this statement with caution. |
RBAC Privileges
Only administrators with the following roles can execute the DROP BUCKET statement:
-
Full Admin
-
Cluster Admin
-
Bucket Admin (if privileges are extended to the specific bucket or all buckets on the cluster)
For more information about roles and privileges, see Roles.
Syntax
drop-bucket ::= 'DROP' ( 'BUCKET' | 'DATABASE' ) ('IF' 'EXISTS' )? name

The BUCKET
and DATABASE
keywords are synonyms.
You can use either of them.
name |
(Required) An identifier that represents the name of the bucket that you want to delete. |
IF EXISTS Clause
The optional IF EXISTS
clause enables the statement to complete successfully when the specified bucket doesn’t exist.
If a bucket with the same name does not exist, then:
-
If this clause is not present, an error is generated.
-
If this clause is present, the statement does nothing and completes without error.
Examples
student-records
DROP BUCKET `student-records`;
custom-bucket
if it existsDROP BUCKET IF EXISTS `custom-bucket`;
Related Links
-
For an overview of buckets, see Buckets.
-
For step-by-step procedures for bucket management, see Manage Buckets.
-
For managing buckets with the REST API, see Buckets API.