Scopes and Collections is a powerful feature in Couchbase that allows developers to isolate data for applications logically, helping enforce independent app lifecycle management and bringing particular advantages in efficient, scalable, highly secure handling of data for distributed mobile and edge applications.
Scopes and Collections support in Capella App Services, which includes Couchbase Lite, the embedded database for mobile and IoT applications, completes our cloud-to-edge vision for Scopes and Collections by supporting fully managed mobile and IoT app deployments on Capella in addition to self-managed deployments.
What are “Scopes and Collections”?
Scopes and Collections provides an elegant way to categorize and organize documents within a Couchbase bucket, allowing data to be accessed and secured at varying levels of granularity. You use collections to organize data, and scopes to group multiple collections.
For example, if your database contains information for a mobile travel application, you might have an “inventory” scope, in which airport documents would be assigned to an “airports” collection, hotel documents to a “hotels” collection, and so on, and access can be secured at these levels as well.
What does that mean for App Services?
In Capella App Services, Scopes and Collections support means:
-
- Data stored in Couchbase Lite can be organized within Scopes and Collections
- Data sync between App Services and Couchbase Lite is Scope/Collection aware
- Peer-to-Peer sync between Couchbase Lite embedded applications is Scope/Collection aware
- Inter-Sync Gateway Replication (ISGR) between Sync Gateway and App Services is Scope/Collection aware
Use cases enabled by Scopes and Collections in App Services
The ability to organize data in Scopes and Collections brings many benefits to distributed mobile and edge applications deployed on Capella App Services, here are just a few examples:
Simplified migration from relational databases
Looking at the hierarchy of bucket>scope>collection, you can think of Collections as tables within a relational database but without the data rigidity. And Scopes are a set of related Collections, making them similar to an RDBMS schema. But in both cases, Scopes and Collections are more flexible since they store JSON documents.
Because of these similarities in the organization of data, migrating from a relational database and adopting Capella App Services for mobile apps becomes much easier for developers.
Scalable Multi-tenant applications
Scopes and Collections in App Services brings the ability to support multi-tenant applications that require independent data lifecycle management, such as an ISV hosting an events application for many enterprise tenants. Previous to this support, multi-tenant apps on App Services would have to create separate buckets for each tenant, making management and scaling of the environment complex and less than cost-effective, especially as tenants increase.
Now with Scopes and Collections, multiple tenants data can be managed and secured in Scopes within a single bucket, making management across the entire app ecosystem easier, while still providing independent data lifecycle management.
High application density at the edge
This is the ability to support large scale cloud-to-edge deployments with a number of applications at the edge, such as a fleet of oil drilling platforms or cruise ships, each running several on-board applications built using microservices. Previous to support for Scopes and Collections, the microservices would run on each vessel in its own bucket, creating complexity for data synchronization and limiting the number of apps served to the number of buckets supported in a cluster.
Now with Scopes and Collections in App Services, each app is associated with a scope and each microservice is associated with its own collection. The result is the ability to host a larger number of applications on fewer clusters.
Go more in-depth into these and other use cases, including example scenarios and reference diagrams in this blog.
Scopes and Collections from cloud-to-edge with App Services
Scopes and Collections are available end-to-end across the entire Couchbase Mobile stack, now including hosted deployments on Capella App Services.
Learn more about Couchbase Mobile and App Services:
And be sure to sign up for the free trial of Capella App Services!