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:
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:
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.
Scopes
A scope is a data container that exists inside a Capella bucket. Use scopes to group related collections.
Each bucket can have a maximum of 1000 scopes.
For more information about how to create a new scope, see Create a Scope.
_default Scope
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.
_system Scope
The _system scope is part of all databases using Couchbase Server 7.6 or later.
When you upgrade a database to Couchbase Server 7.6, Capella adds the _system scope to your existing buckets.
|
All sample buckets and buckets that you create include a _system
scope.
The _system
scope contains the _mobile
and _query
collections that store system documents for related Couchbases services.
The _system
scope and its collections are read-only, and their structure is subject to change without notice.
Do not use these collections for other purposes.
You cannot remove the _system
scope or its collections.
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.