Manage Scopes and Collections

    +
    Scopes and collections, which allow documents to be categorized and organized within a bucket, can be created and deleted.

    Scopes and collections categorize and organize documents within a bucket. A collection is a data container within a bucket. A scope is a mechanism that groups multiple collections together. Each cluster can hold up to 1000 scopes and up to 1000 collections. For a complete overview, see Scopes and Collections.

    Scopes and collections is a Couchbase Server 7.0+ feature that is not available to clusters running Couchbase Server 6.6.

    Accessing Scopes in the Couchbase Capella UI

    Scopes can be viewed and managed from the Clusters section, in the Buckets tab, by clicking the More options button at the end of the row on the right side of the bucket you are working with and clicking Scopes:

    A cluster’s 'Buckets' tab showing a table of multiple buckets with the Scopes menu option shown.

    Scopes View

    A bucket’s Scopes view lists all the scopes within that bucket in a tabular format, including the number of collections within each scope. Actions are available to create and delete scopes, as well as add collections to a scope. Above this table is a drop-down list that allows you to quickly switch between buckets in the current cluster and view their respective scopes.

    Create a Scope

    To create a scope, you need to have the Project Owner or Cluster Manager role for the project that contains the cluster and bucket in which you are creating the scope.

    1. Go to the cluster’s Buckets tab.

      1. Go to the Clusters tab in the main navigation.

      2. Find and click on the cluster that you wish to add a scope to.

        This opens the cluster with its Metrics tab selected.

      3. Click the Buckets tab.

    2. Open the Scopes page.

      1. At the end of the row on the right side of the bucket you are working with, click the More options button.

      2. Click Scopes.

    3. Click Create Scope.

      This opens the Create Scope fly-out menu.

    4. Specify a name for the scope.

      In the Name of scope field, enter a name for the scope. A scope name can only contain the A-Z, a-z, and 0-9 characters as well as the -, _, and % symbols. It cannot start with either the _ or % symbols. It cannot be longer than 251 characters in length and is case-sensitive.

    5. Click Add.

      Once the scope is created it is listed in the Scopes view for the current bucket.

    Delete a Scope

    To delete a scope, you need to have the Project Owner or Cluster Manager role for the project that contains the cluster and bucket in which you are deleting the scope.

    Deleting a scope will also delete all of the collections and documents within that scope from the cluster. You can only restore these from a previous backup.

    1. Go to the cluster’s Buckets tab.

      1. Go to the Clusters tab in the main navigation.

      2. Find and click on the cluster where you wish to delete a scope.

        This opens the cluster with its Metrics tab selected.

      3. Click the Buckets tab.

    2. Open the Scopes page.

      1. At the end of the row on the right side of the bucket you are working with, click the More options button.

      2. Click Scopes.

    3. Click Delete Scope.

      1. At the end of the row on the right side of the scope you are working with, click the More options button.

      2. Click Delete Scope.

        This opens the Delete Scope fly-out menu.

    4. Confirm the delete request.

      1. In the Type “delete” to confirm field, type delete.

      2. Click Confirm.

      When a scope is successfully deleted, a confirmation notification will appear near the top of the screen and the deleted scope will be removed from the Scopes view.

    Accessing Collections in the Couchbase Capella UI

    Collections can be viewed and managed from the Clusters section, in the Buckets tab, by clicking the More options button at the end of the row on the right side of the bucket you are working with and clicking Collections:

    A cluster’s 'Buckets' tab showing a table of multiple buckets with the Collections menu option shown.

    This shows the Collections view for the _default scope. You can change the scope whose collections you wish to view using the drop-down list above the table.

    For a broader overview of the collections within a bucket, the Scopes view lists the number of collections within each scope. Clicking a collections count number in a scope row lists all the collections within that scope.

     A Scopes page showing the number of collections within a scope

    Collections View

    A scope’s Collections view lists all the collections within the current scope in tabular format, including a time to live (TTL) value for each. Buttons are available to delete individual collections. Above this table are drop-down lists that allow you to quickly switch between buckets and scopes in the current cluster.

    Create a Collection

    To create a collection, you need to have the Project Owner or Cluster Manager role for the project that contains the cluster, bucket, and scope in which you are creating the collection.

    1. Go to the cluster’s Buckets tab.

      1. Go to the Clusters tab in the main navigation.

      2. Find and click on the cluster where you wish to create a collection.

        This opens the cluster with its Metrics tab selected.

    2. Click the Buckets tab.

    3. Open the Scopes view.

      1. At the end of the row on the right side of the bucket you are working with, click the More options button.

      2. Click Scopes.

    4. Open the Collections view.

      1. Click the Collections count number in the row of the scope in question.

    5. Click Create Collection.

      This opens the Create Collection fly-out menu.

    6. Specify a name for the collection.

      In the Name of collection field, enter a name for the collection. A collection name can only contain the A-Z, a-z, and 0-9 characters as well as the -, _, and % symbols. It cannot start with either the _ or % symbols. It cannot be longer than 251 characters in length and is case-sensitive.

    7. Specify a time to live (TTL) value.

      A collection’s TTL cannot be changed after its creation. Take care to ensure that this value is set correctly to match your requirements.

      1. In the TTL (Time To Live) in seconds field, enter an expiration time for the new collection. By default, this field is set to 0, which indicates that no expiration time is applied. For more information on expirations and collections, see Expiration.

    8. Click Add.

      Once the collection is created, it is listed in the Collections view for the current scope.

    Delete a Collection

    To delete a collection, you need to have the Project Owner or Cluster Manager role for the project that contains the cluster, bucket, and scope in which you are deleting the collection.

    Deleting a collection will delete all of the documents within it from the cluster. You can only restore these documents from a previous backup.
    1. Go to the cluster’s Buckets tab.

      1. Go to the Clusters tab in the main navigation.

      2. Find and click on the cluster where you wish to delete a collection.

        This opens the cluster with its Metrics tab selected.

    2. Click the Buckets tab.

    3. Open the Collections view page.

      1. At the end of the row on the right side of the bucket you are working with, click the More options button.

      2. Click Collections.

    4. Using the Scopes drop-down menu above the list of collections, choose the scope you wish to open.

    5. Find the collection that you wish to delete, and click the Trash icon at the end of the row on the right side.

      This opens the Delete Collection fly-out menu.

    6. Confirm the delete request.

      1. In the Type “delete” to confirm field, type delete.

      2. Click Confirm.

      When a collection is successfully deleted, a confirmation notification is shown near the top of the screen and the deleted collection will be removed from the Collections view.