Implement the Data Model

  • Capella Operational
  • tutorial
March 23, 2025
+ 12
Learn how to logically partition your data in Capella Operational using buckets, scopes, and collections.

Buckets, Scopes, and Collections

To organize and manage your data in Couchbase, you can create buckets, scopes, and collections inside your cluster.

A bucket is equivalent to a database in a relational database management system, while scopes and collections are used to provide separation between documents of different types.

couchbase-hierarchy
bucket

Stores and retrieves data in the server.

scope

Stores collections. When you create a new bucket, Couchbase provides you with a default scope called _default.

collection

Contains a set of documents. Couchbase provides you with a default collection called _default.

For more information, see Buckets, Scopes, and Collections.

Create a Bucket, Scope, and Collection

To continue this tutorial, you must create a bucket to hold all student data, a scope to narrow down the data into only data related to an art school, and two collections to narrow it down further into art school students and art school courses.

To create the data model from the Capella UI:

  1. On the Operational tab, select student-cluster.

  2. Click the Data Tools tab.

  3. In the left pane, click + Create.

  4. Under Bucket, select New and enter the name student-bucket. Keep the default 100 MiB memory quota.

  5. Under Scope, enter the name art-school-scope.

  6. Under Collection, enter the name student-record-collection for your first collection.

  7. Click Create.

To create the second collection, follow the above steps but use the existing student-bucket and art-school-scope, and then create a collection with the name course-record-collection.

The two collections allow you to use the relational model and the document model at the same time to achieve the best design and performance possible.

The student-record-collection contains student records, and each student record contains a list of that student’s enrollments. Unlike the standard relational model decomposition where a link table is created between students and courses, a document model stores the enrollments as part of the student records.

The course-record-collection, on the other hand, uses the relational model to link the enrollment records to the course records they apply to. This allows you to retrieve other details like the full title of the course or the number of credits students receive upon completing the course.

Next Steps