{"id":9783,"date":"2021-08-03T00:00:43","date_gmt":"2021-08-03T07:00:43","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=9783"},"modified":"2025-06-13T20:46:01","modified_gmt":"2025-06-14T03:46:01","slug":"scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/","title":{"rendered":"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase"},"content":{"rendered":"<p><strong>Now it&#8217;s easier than ever to build and deploy microservices and multi-tenant applications on Couchbase.<\/strong> The 7.0 release introduces a new data organization feature called Scopes and Collections.<\/p>\n<p>Scopes and Collections allow logical isolation of different types of data, independent lifecycle management and security control at multiple levels of granularity. Application developers use them to organize and isolate their data. DevOps and admins find the multiple levels of role-based access control (RBAC) \u2013 at the Bucket, Scope and Collection level \u2013 a powerful option to host microservices and tenants at scale.<\/p>\n<p>The full functionality of this feature is <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-server-7-0-release\/?ref=blog\" target=\"_blank\" rel=\"noopener\">now available in Couchbase Server 7.0<\/a>. A limited functionality Developer Preview was already available in release 6.5, and some of you may have already kicked the tires on that.<\/p>\n<h2>What Are Couchbase Scopes and Collections<\/h2>\n<p>Scopes and Collections are logical containers within a <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/buckets-memory-and-storage\/buckets.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase Bucket<\/a>.<\/p>\n<p>It&#8217;s helpful to think of Collections as tables within a relational database but without the data rigidity. 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.<\/p>\n<p>The table below shows the mapping of familiar RDBMS constructs to Couchbase:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9785\" style=\"width: 778px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9785\" class=\"wp-image-9785 size-medium_large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/RDBMSComparisonTable-768x378.png\" alt=\"RDBMS concepts mapped to the Couchbase Data Platform\" width=\"768\" height=\"378\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable-768x378.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable-300x148.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable-1024x504.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable-20x10.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable-1320x650.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/RDBMSComparisonTable.png 1348w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><p id=\"caption-attachment-9785\" class=\"wp-caption-text\">Mapping RDBMS concepts to Couchbase<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Here is an example of organizing the Couchbase Travel App data with Scopes and Collections:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9792\" style=\"width: 778px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9792\" class=\"wp-image-9792 size-medium_large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/TravelBucketExample-2-768x510.png\" alt=\"Couchbase Scopes and Collections example\" width=\"768\" height=\"510\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-768x510.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-300x199.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-1024x680.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-400x267.png 400w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-450x300.png 450w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2-20x13.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/TravelBucketExample-2.png 1240w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><p id=\"caption-attachment-9792\" class=\"wp-caption-text\">An example of Scopes and Collections with an example dataset<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>How to Create and Use Scopes &amp; Collections<\/h2>\n<p>You can create Scopes and Collections from any of the Couchbase SDKs, <code>couchbase-cli<\/code>, REST APIs, N1QL or from the UI.<\/p>\n<p>In particular, <a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">N1QL<\/a>N1QL queries become much simpler and syntactically briefer as you no longer need to qualify different document types using <code>where type = xxx<\/code>. Instead you simply refer to the Collection directly.<\/p>\n<p>In the example shown below, we use N1QL (I executed the N1QL statements using <a href=\"https:\/\/docs.couchbase.com\/server\/current\/tools\/cbq-shell.html?ref=blog\" target=\"_blank\" rel=\"noopener\">cbq shell<\/a>) to create a Scope, a couple of Collections and some indexes. Then we run a simple query that joins two Collections.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9786\" style=\"width: 1438px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9786\" class=\"wp-image-9786 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/CreationAndN1QLExample.png\" alt=\"Create a Scope, Collections and indexes using the N1QL query language for Couchbase\" width=\"1428\" height=\"1050\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample.png 1428w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample-300x221.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample-1024x753.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample-768x565.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample-20x15.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/CreationAndN1QLExample-1320x971.png 1320w\" sizes=\"auto, (max-width: 1428px) 100vw, 1428px\" \/><p id=\"caption-attachment-9786\" class=\"wp-caption-text\">A N1QL query to create a Scope, Collections and indexes<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>The Scale of Scopes &amp; Collections<\/h2>\n<p>Couchbase currently allows you to have 30 Buckets in a single cluster. Scopes and Collections allow you to create orders-of-magnitude higher numbers of these entities.<\/p>\n<p>Since Collections actually contain the data and Scopes organize related Collections, you typically have fewer Scopes than Collections. Global Secondary Indexes (GSIs) are created on Collections, and a Collection commonly has multiple indexes.<\/p>\n<p>Keeping these requirements in mind, here is the scale of these entities that you can create in Couchbase 7.0 (a lot of them!):<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Number of Collections allowed per cluster: 1,000<\/li>\n<li>Number of Scopes allowed per cluster: 1,000<\/li>\n<li>Number of Global Secondary Indexes allowed per cluster: 10,000<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Enabling Multi-Tenancy at Scale<\/h2>\n<p>Modern applications are often written as microservices, with each application consisting of several (and sometimes hundreds) of microservices.<\/p>\n<p>With the advent of SaaS and all its advantages, many of these applications are multi-tenant. For enterprise teams, it&#8217;s important to keep the cost low for hosting multiple applications and tenants (i.e., TCO), while providing the required isolation and flexibility.<\/p>\n<p>Couchbase Buckets, Scopes and Collections now provide a three-level containment hierarchy to help you map your applications, tenants and microservices.<\/p>\n<h2>Key Features for Multi-Tenancy &amp; Microservice Consolidation<\/h2>\n<p>Let\u2019s dive into the capabilities offered by Scopes and Collections that make it possible to consolidate tenants and microservices.<\/p>\n<h3>Logical Isolation &amp; Indexing<\/h3>\n<p>Collections allow you to isolate your data by type while enjoying the flexibility of a JSON document database model that evolves with your application.<\/p>\n<p>As shown in the Travel example further above, the Airline documents go into the Airline Collection, the Hotel documents go into the Hotel Collection and so forth.<\/p>\n<p>Each Collection can also be indexed individually. Different types of documents typically have different indexing needs, and Collections enable you to define different indexes for each type.<\/p>\n<h3>Lifecycle Management at Multiple Levels<\/h3>\n<p>Scopes and Collections allow you to manage and monitor your data at two new levels in addition to the existing Bucket level.<\/p>\n<p>The provided functionality includes:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Create and drop individual Collections or Scopes<\/li>\n<li>Set expiration (maximum time to live, a.k.a., Max <a href=\"https:\/\/www.couchbase.com\/blog\/how-to-manage-ttl-with-couchbase-n1ql\/\">TTL<\/a>) at the Collection level<\/li>\n<li>Monitor statistics at the Scope and Collection level. Although a full set of statistics are available only at Bucket level, a subset of statistics is available at Collection and Scope levels (e.g., item count, memory used, disk space used, operations per sec).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Fine-Grained Access Control with RBAC<\/h3>\n<p>One of the most powerful aspects of Scopes and Collections is the ability to control security at multiple levels \u2013 Bucket, Scope, Collection \u2013 using role-based access control (RBAC). This is the key to consolidating hundreds of microservices and\/or tenants in a single Couchbase cluster.<\/p>\n<p>Now, you can give a user access to a whole Bucket or to a Scope or to a Collection. Several out-of-box user roles are available, and <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/manage\/manage-security\/manage-users-and-roles.html?ref=blog\" target=\"_blank\" rel=\"noopener\">more details are available in the RBAC documentation<\/a>).<\/p>\n<h3>Fine-Grained Replication Control with XDCR<\/h3>\n<p>Cross Data Center Replication (XDCR) allows you to control replication at the Bucket, Scope or Collection level.<\/p>\n<p>You can choose to replicate a whole Bucket, a Scope or just a Collection. You can map to a similarly named entity on the destination or remap to a different entity. You also have the flexibility of advanced filtering, which was already introduced for XDCR in release 6.5 of Couchbase.<\/p>\n<p>The flexibility provided by XDCR is crucial to mapping microservices and\/or tenants to Collections and Scopes as it allows you to control each microservice and tenant individually.<\/p>\n<h3>Backup\/Restore at Multiple Levels<\/h3>\n<p>Continuing the theme of lifecycle management at multiple levels, Couchbase 7.0 allows you to control backup and restore options at each of these levels as well.<\/p>\n<p>Hence, you can backup (and similarly restore) an individual Bucket, Scope or Collection, along with filtering the data and remapping it during restore.<\/p>\n<p><em>Watch out for more detailed how-to blogs on each of these above themes (RBAC, XDCR and Backup\/Restore) in the coming weeks!<\/em><\/p>\n<h2>Microservices Deployment Using Collections<\/h2>\n<p>A typical <a href=\"https:\/\/www.couchbase.com\/blog\/microservices-architecture-in-couchbase\/\">microservices architecture<\/a> recommends that each microservice be simple (ideally single-function), loosely coupled from other microservices (which means have its own data store), and scale independently.<\/p>\n<p>Prior to <a href=\"https:\/\/www.couchbase.com\/products\/server\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase Server<\/a> 7.0, you could either host each microservice in a separate cluster or a separate Bucket. These deployment options have inherent limits on application density and may not always result in full hardware utilization. Now with Couchbase 7.0, you can map each microservice to one or more Collections. And since you can have up to a thousand Collections, you can have a thousand microservices in a single cluster(!).<\/p>\n<p>Let&#8217;s look at the example microservice deployment shown below:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9787\" style=\"width: 778px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9787\" class=\"wp-image-9787 size-medium_large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MicroserviceDeploymentExample-768x517.png\" alt=\"Microservices consolidation using Couchbase Scopes and Collections\" width=\"768\" height=\"517\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MicroserviceDeploymentExample-768x517.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MicroserviceDeploymentExample-300x202.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MicroserviceDeploymentExample-1024x689.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MicroserviceDeploymentExample-20x13.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MicroserviceDeploymentExample.png 1064w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><p id=\"caption-attachment-9787\" class=\"wp-caption-text\">Microservices consolidation using Couchbase Scopes and Collections<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The above example shows two CRM applications (Sales and Customers) deployed in a single cluster. Each of the two applications is mapped to a Bucket allowing you to control the overall resource allocation to each application.<\/p>\n<p>The Sales application has two microservices: Orders and Shipping, and the Customers application has two microservices: Individuals and Accounts. We map each of the microservices to their own Collection. In this example, we didn&#8217;t use Scopes. You don\u2019t have to define Scopes if you don\u2019t need the extra level of organization (the default Scope is used instead).<\/p>\n<h2>Multi-Tenant Deployment Using Scopes<\/h2>\n<p>Multi-tenant applications require varying levels of isolation between tenants and varying levels of resource sharing of the underlying infrastructure. The chosen deployment architecture is a trade-off between isolation and total cost of ownership (TCO).<\/p>\n<p>Some tenants may require complete physical isolation in which case separate clusters for each tenant may be the right architecture, albeit at a high TCO. Couchbase Buckets provide partial physical isolation and full security and logical isolation and can be used for separate tenants though with limits of scale and overhead-per-Bucket.<\/p>\n<p>Logical and security isolation across tenants is often sufficient. With Scopes, you get security and logical isolation at more granular levels within a Bucket. You can have thousands of Scopes in a single Bucket, enabling you to host thousands of co-operative tenants (those not requiring physical isolation) in a single cluster.<\/p>\n<p>The trade-offs between TCO and isolation levels between different multi-tenant architectures are captured in the table below.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9903\" style=\"width: 910px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9903\" class=\"wp-image-9903 size-large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MultiTenancyIsolationVsTCOTableNew-1024x502.png\" alt=\"Multi-tenant architecture choices using Couchbase Scopes and Collections\" width=\"900\" height=\"441\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenancyIsolationVsTCOTableNew-1024x502.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenancyIsolationVsTCOTableNew-300x147.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenancyIsolationVsTCOTableNew-768x376.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenancyIsolationVsTCOTableNew-20x10.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenancyIsolationVsTCOTableNew.png 1192w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><p id=\"caption-attachment-9903\" class=\"wp-caption-text\">Multi-tenant architecture choices using Couchbase Scopes and Collections<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Imagine that the CRM applications in the example above need to become multi-tenant. You can easily do so by mapping each tenant to a separate Scope as shown below. (<code>Cust1<\/code> and <code>Cust2<\/code> are the two different tenants in this example.)<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<div id=\"attachment_9789\" style=\"width: 910px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9789\" class=\"wp-image-9789 size-large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MultiTenantDeploymentWithScopes-1024x633.png\" alt=\"Multi-tenancy with Scopes in Couchbase\" width=\"900\" height=\"556\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenantDeploymentWithScopes-1024x633.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenantDeploymentWithScopes-300x185.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenantDeploymentWithScopes-768x474.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenantDeploymentWithScopes-20x12.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MultiTenantDeploymentWithScopes.png 1172w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><p id=\"caption-attachment-9789\" class=\"wp-caption-text\">Multi-tenancy with Scopes in Couchbase<\/p><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Achieving multi-tenancy with Scopes is fairly straightforward (without requiring application changes as you can pass a Scope context around). It&#8217;s also a scalable and cost-effective solution. Collection names need to be unique only within a Scope. Hence, you can easily deploy multiple Scopes with the same Collection names as shown above.<\/p>\n<h2>Next Steps<\/h2>\n<p>I hope you enjoy the new Scopes and Collections functionality in Couchbase. Below is a list of resources for you to get started and we look forward to your feedback on the <a href=\"https:\/\/www.couchbase.com\/forums\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase Forums<\/a>.<\/p>\n<p><strong>Documentation &amp; Articles<\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/products\/server\/whats-new\/?ref=blog\" target=\"_blank\" rel=\"noopener\">What&#8217;s New in Couchbase 7.0<\/a><\/li>\n<li><a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/release-notes\/relnotes.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase 7.0 release notes<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-transactions-with-n1ql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">The N1QL Query Language Now Supports Distributed ACID Transactions<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 30px\" aria-hidden=\"true\"><\/div>\n<div style=\"text-align: center\"><strong>Ready to try out Scopes and Collections for yourself?&lt;br\/ &gt;<a href=\"https:\/\/www.couchbase.com\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Download Couchbase Server 7.0 today<\/a><\/strong><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now it&#8217;s easier than ever to build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces a new data organization feature called Scopes and Collections. Scopes and Collections allow logical isolation of different types of data, independent [&hellip;]<\/p>\n","protected":false},"author":31463,"featured_media":11655,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,9416,1821,1816,9415,1819,9336,1812],"tags":[9350,1308,1261,2103,9349,1903,1962],"ppma_author":[9079],"class_list":["post-9783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-backup","category-couchbase-architecture","category-couchbase-server","category-xdcr","category-data-modeling","category-scopes-and-collections","category-n1ql-query","tag-cbq-shell","tag-devops","tag-json","tag-microservices","tag-multi-tenancy","tag-rbac","tag-role-based-access-control"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Multi-Tenant App Deployments with Scopes &amp; Collections<\/title>\n<meta name=\"description\" content=\"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase\" \/>\n<meta property=\"og:description\" content=\"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-03T07:00:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:46:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-social.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"418\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Shivani Gupta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-social.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shivani Gupta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\"},\"author\":{\"name\":\"Shivani Gupta\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1\"},\"headline\":\"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase\",\"datePublished\":\"2021-08-03T07:00:43+00:00\",\"dateModified\":\"2025-06-14T03:46:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\"},\"wordCount\":1587,\"commentCount\":14,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg\",\"keywords\":[\"cbq shell\",\"DevOps\",\"JSON\",\"microservices\",\"multi-tenancy\",\"RBAC\",\"Role Based Access Control (RBAC)\"],\"articleSection\":[\"Application Design\",\"Backup\",\"Couchbase Architecture\",\"Couchbase Server\",\"Cross Data Center Replication (XDCR)\",\"Data Modeling\",\"Scopes and Collections\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\",\"name\":\"Multi-Tenant App Deployments with Scopes & Collections\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg\",\"datePublished\":\"2021-08-03T07:00:43+00:00\",\"dateModified\":\"2025-06-14T03:46:01+00:00\",\"description\":\"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg\",\"width\":1200,\"height\":628,\"caption\":\"Learn how Couchbase Scopes & Collections simplify microservices and multi-tenant app deployments\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1\",\"name\":\"Shivani Gupta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/958854edc0e632ef5d325afcfa90cf32\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21281e35ea9170ee660a9c1417cf39f4b04015e2628fd86f3d7580a305964fa8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21281e35ea9170ee660a9c1417cf39f4b04015e2628fd86f3d7580a305964fa8?s=96&d=mm&r=g\",\"caption\":\"Shivani Gupta\"},\"description\":\"Shivani Gupta is Director of Product Management at Couchbase for the Core Server. Shivani has over 20 years of varied experience in Big Data, Distributed Systems, and Databases at different companies including Oracle, Microsoft, VMWare, Hortonworks and now Couchbase.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/shivani-gupta\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Multi-Tenant App Deployments with Scopes & Collections","description":"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/","og_locale":"en_US","og_type":"article","og_title":"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase","og_description":"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.","og_url":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-08-03T07:00:43+00:00","article_modified_time":"2025-06-14T03:46:01+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-social.jpg","type":"image\/jpeg"}],"author":"Shivani Gupta","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-social.jpg","twitter_misc":{"Written by":"Shivani Gupta","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/"},"author":{"name":"Shivani Gupta","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1"},"headline":"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase","datePublished":"2021-08-03T07:00:43+00:00","dateModified":"2025-06-14T03:46:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/"},"wordCount":1587,"commentCount":14,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg","keywords":["cbq shell","DevOps","JSON","microservices","multi-tenancy","RBAC","Role Based Access Control (RBAC)"],"articleSection":["Application Design","Backup","Couchbase Architecture","Couchbase Server","Cross Data Center Replication (XDCR)","Data Modeling","Scopes and Collections","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/","url":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/","name":"Multi-Tenant App Deployments with Scopes & Collections","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg","datePublished":"2021-08-03T07:00:43+00:00","dateModified":"2025-06-14T03:46:01+00:00","description":"Build and deploy microservices and multi-tenant applications on Couchbase. The 7.0 release introduces the Scopes and Collections data organization feature.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/couchbase-scopes-collections-simplify-microservices-multi-tenant-app-deployments-release.jpg","width":1200,"height":628,"caption":"Learn how Couchbase Scopes & Collections simplify microservices and multi-tenant app deployments"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How Scopes &amp; Collections Simplify Multi-Tenant App Deployments on Couchbase"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1","name":"Shivani Gupta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/958854edc0e632ef5d325afcfa90cf32","url":"https:\/\/secure.gravatar.com\/avatar\/21281e35ea9170ee660a9c1417cf39f4b04015e2628fd86f3d7580a305964fa8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21281e35ea9170ee660a9c1417cf39f4b04015e2628fd86f3d7580a305964fa8?s=96&d=mm&r=g","caption":"Shivani Gupta"},"description":"Shivani Gupta is Director of Product Management at Couchbase for the Core Server. Shivani has over 20 years of varied experience in Big Data, Distributed Systems, and Databases at different companies including Oracle, Microsoft, VMWare, Hortonworks and now Couchbase.","url":"https:\/\/www.couchbase.com\/blog\/author\/shivani-gupta\/"}]}},"authors":[{"term_id":9079,"user_id":31463,"is_guest":0,"slug":"shivani-gupta","display_name":"Shivani Gupta","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/21281e35ea9170ee660a9c1417cf39f4b04015e2628fd86f3d7580a305964fa8?s=96&d=mm&r=g","author_category":"","last_name":"Gupta","first_name":"Shivani","job_title":"","user_url":"","description":"Shivani Gupta is Director of Product Management at Couchbase for the Core Server. Shivani has over 20 years of varied experience in Big Data, Distributed Systems, and Databases at different companies including Oracle, Microsoft, VMWare, Hortonworks and now Couchbase."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/9783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/31463"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=9783"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/9783\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/11655"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=9783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=9783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=9783"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=9783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}