Buckets, Scopes, and Collections

  • concept
    +
    The data in a Couchbase Capella database is categorized and organized into different data containers. These data containers hold documents, which hold JSON key-value pairs that define your data.

    Capella databases have 3 types of data containers:

    Diagram

    Use the hierarchy of buckets, scopes, and collections to categorize and organize your data for quick and easy retrieval.

    Store documents in collections and group similar collections with scopes. For example, you could use scopes and collections to group data in a travel application:

    Diagram
    You can create new buckets, scopes, and collections when you import data into your database. For more information, see Import Data with the Capella UI.

    Buckets

    Buckets are the top-level storage containers for data in a Capella database.

    You must create a bucket before you can store any data in your database. A Capella database can have a maximum of 30 buckets.

    For more information about how to create a new bucket, see Create a Bucket.

    Diagram

    Scopes

    A scope is a data container that exists inside a Capella bucket. Use scopes to group related collections.

    Each Capella bucket starts with a _default scope, which contains a _default collection. Any document that you create without a specific scope is assigned to the _default scope and collection.

    You cannot remove the _default scope.

    Each bucket can have a maximum of 1000 scopes.

    For more information about how to create a new scope, see Create a Scope.

    Diagram

    Collections

    A collection is a data container that exists inside a Capella scope. It’s the smallest container that holds the documents inside a bucket.

    Each Capella bucket starts with a _default scope, which contains a _default collection. Any document that you create without a specific scope is assigned to the _default scope and collection.

    If you remove the _default collection from a scope, you cannot recreate it.

    Each scope in a bucket can have a maximum of 1000 collections.

    For more information about how to create a new collection, see Create a Collection.

    Diagram