{"id":9884,"date":"2021-09-03T00:00:50","date_gmt":"2021-09-03T07:00:50","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=9884"},"modified":"2025-06-13T20:45:58","modified_gmt":"2025-06-14T03:45:58","slug":"how-to-migrate-to-scopes-and-collections-in-couchbase-7-0","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/","title":{"rendered":"How to Migrate to Scopes &amp; Collections in Couchbase 7.0"},"content":{"rendered":"<p><strong>Whether you&#8217;re new to Couchbase or<\/strong> a seasoned vet, you&#8217;ve likely heard about Scopes and Collections. If you&#8217;re ready to try them out for yourself, this article helps you make it happen.<\/p>\n<p>Scopes and Collections are a new feature introduced in <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-server-7-0-release\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the Couchbase Server 7.0 release<\/a> that allows you to logically organize data within Couchbase. To learn more, <a href=\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/?ref=blog\" target=\"_blank\" rel=\"noopener\">read the following introduction to Scopes and Collections<\/a>.<\/p>\n<p>You should take advantage of Scopes and Collections if you want to map your legacy RDBMS to a document database or if you&#8217;re trying to consolidate hundreds of microservices and\/or tenants into a single <a href=\"https:\/\/www.couchbase.com\/products\/capella\/\" target=\"_blank\" rel=\"noopener\">Couchbase<\/a> cluster (resulting in much lower TCO).<\/p>\n<p>In this article, I&#8217;ll go over how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.<\/p>\n<h2>High-Level Migration Steps<\/h2>\n<p>The following are the high level steps of migrating to Scopes and Collections in Couchbase 7.0.<\/p>\n<p>Not all steps are essential: it all depends on your use case and particular technology requirements. I&#8217;ll walk you through the details of each of these steps in subsequent sections.<\/p>\n<ol>\n<li><strong>Upgrade to Couchbase Server 7.0<\/strong><\/li>\n<li><strong>Plan your Scopes and Collections strategy<\/strong>: Determine what Buckets, Scopes, Collections and indexes you need. Determine the mapping from old Bucket(s) to new Bucket(s)\/Scope(s)\/Collections. Write scripts to create Scopes, Collections and indexes.<\/li>\n<li><strong>Migrate your application code:<\/strong> This application code is your Couchbase SDK code including N1QL queries.<\/li>\n<li><strong>Data migration:<\/strong> Determine if an offline strategy works for your deployment or if you need an online migration. Take action accordingly.<\/li>\n<li><strong>Plan and implement your database security strategy:<\/strong> Determine what Users and Role assignments you need. Create scripts to manage these assignments.<\/li>\n<li><strong>Go live with your new Collections-aware application<\/strong><\/li>\n<li><strong>Setup XDCR and setup Backup for your Couchbase database<\/strong><\/li>\n<\/ol>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Upgrade to Couchbase 7<\/h2>\n<p>Here&#8217;s what you need to know about upgrading to <a href=\"https:\/\/www.couchbase.com\/products\/server\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase Server<\/a> 7.0:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Every Bucket in 7.0+ has a `_default` Scope with a `_default` Collection in it.<\/li>\n<li>Upgrading to Couchbase 7.0 moves all data in the Bucket to the `_default` Collection of the Bucket.<\/li>\n<li>There is <strong>no impact to existing applications<\/strong>. For example, an SDK 2.7 reference to Bucket `B` automatically resolves to `B._default._default` (referencing the `_default` Scope and Collection, respectively).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The diagram below illustrates how data is organized in Buckets, Scopes and Collections after migrating data from Couchbase 6 to Couchbase 7.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/UpgradeTo7.0-e1605927134950.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9885\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/UpgradeTo7.0-e1605927134950.png\" alt=\"Migrating data to Couchbase 7 with Scopes and Collections\" width=\"1250\" height=\"610\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/UpgradeTo7.0-e1605927134950.png 1250w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/UpgradeTo7.0-e1605927134950-300x146.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/UpgradeTo7.0-e1605927134950-1024x500.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/UpgradeTo7.0-e1605927134950-768x375.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/UpgradeTo7.0-e1605927134950-20x10.png 20w\" sizes=\"auto, (max-width: 1250px) 100vw, 1250px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>If you do not wish to use named Scopes and Collections, stop right here.<\/p>\n<p>But if you&#8217;re ready to use this new data organization feature, read on.<\/p>\n<h2>Plan Your Scopes and Collections Strategy<\/h2>\n<p>Below are the most common database migration scenarios that I&#8217;ve come across. Your migration scenario might be different and mileage may vary.<\/p>\n<h3>Consolidation: From Multiple Buckets to Collections in a Single Bucket<\/h3>\n<p>One common scenario is when you&#8217;re trying to lower your total cost of ownership (TCO) by consolidating multiple Buckets into a single Bucket.<\/p>\n<p>A cluster can only have up to 30 Buckets, whereas you can have 1000 Collections per cluster, allowing for much higher density. This is a common scenario for microservices consolidation.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MigrationConsolidationScenario.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9886\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MigrationConsolidationScenario.png\" alt=\"Consolidating Couchbase Buckets into a single Bucket with multiple Collections\" width=\"1210\" height=\"938\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationConsolidationScenario.png 1210w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationConsolidationScenario-300x233.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationConsolidationScenario-1024x794.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationConsolidationScenario-768x595.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationConsolidationScenario-20x16.png 20w\" sizes=\"auto, (max-width: 1210px) 100vw, 1210px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The diagram above shows all target Collections belonging to the same Scope. But you could just as well have the target Collections belong in different Scopes.<\/p>\n<h3>Splitting: From Single Bucket to Multiple Collections in a Bucket<\/h3>\n<p>Another common scenario is to migrate the data that resides within a single Bucket and split it out into multiple Collections (within the same Bucket).<\/p>\n<p>You might have previously qualified different types of data with a `type = foo` field or with a key prefix like `foo_key`. Now these data types can each live in their own Collection, giving you the advantages of logical isolation, security isolation, replication and access control.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MigrationSplittingScenario.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9887\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/MigrationSplittingScenario.png\" alt=\"Splitting Couchbase data into multiple Collections within the same Bucket\" width=\"1236\" height=\"912\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationSplittingScenario.png 1236w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationSplittingScenario-300x221.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationSplittingScenario-1024x756.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationSplittingScenario-768x567.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/MigrationSplittingScenario-20x15.png 20w\" sizes=\"auto, (max-width: 1236px) 100vw, 1236px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>This scenario may be a little more complex than the previous &#8220;consolidation&#8221; scenario, especially if you want to get rid of the key prefix or type field. For a simpler migration, you may want to leave the key prefixes and type data fields as is, even though they may be somewhat redundant with Collections.<\/p>\n<h3>Creation of Scopes, Collections and Indexes<\/h3>\n<p>Once you&#8217;ve planned what Scopes, Collections and indexes you want to have, you need to create scripts for creation of these entities. You can use <a href=\"https:\/\/www.couchbase.com\/products\/developer-sdk\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the Couchbase SDK<\/a> of your choice, <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/manage\/manage-scopes-and-collections\/manage-scopes-and-collections.html?ref=blog\" target=\"_blank\" rel=\"noopener\">the couchbase-cli, the REST APIs directly, or even N1QL scripts<\/a> to do so.<\/p>\n<p>Below is an example of using the CLI (couchbase-cli and cbq shell) to create a Scope, a Collection and an index.<\/p>\n<pre class=\"lang:default decode:true\" title=\"CLI sample commands to create Scope, Collection and index\">\/\/ create a Scope called 'myscope' using couchbase-cli\r\n.\/couchbase-cli  collection-manage -c localhost -u Administrator -p password --bucket testBucket --create-scope myscope\r\n\r\n\/\/ create a Collection called mycollection in myscope\r\n.\/couchbase-cli  collection-manage -c localhost -u Administrator -p password --bucket testBucket --create-collection myscope.mycollection\r\n\r\n\/\/ create an index on mycollection using cbq\r\n.\/cbq --engine=localhost:8093 -u Administrator -p password --script=\"create index myidx1 on testBucket.myscope.mycollection(field1,field2);\"\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Note that the <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/createindex.html\">index creation<\/a> statement does <strong>not<\/strong> require you to qualify the data with a `type = foo` or key-prefix qualification clause anymore.<\/p>\n<h2>Migrate Your Application Code<\/h2>\n<p>In order to use named Scopes and Collections, your application code (including <a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">N1QL queries<\/a>) needs to be migrated.<\/p>\n<p>If you were using type fields or key prefixes previously (as in the splitting scenario), you will <strong>not<\/strong> need them anymore.<\/p>\n<h3>SDK Code Sample<\/h3>\n<p>In your SDK code, you have to connect to a cluster, open a Bucket and obtain a reference to a Collection object to store and retrieve documents. Prior to Collections, all key-value operations were performed directly on the Bucket.<\/p>\n<p><em>Note: If you have migrated to Couchbase SDK 3.0, you have already done some of the work of starting to use Collections (though until now you could only use the default Collection).<\/em><\/p>\n<p>The following is a simple <a href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/hello-world\/start-using-sdk.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Java SDK<\/a> code snippet for storing and retrieving a document to a Collection:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Java SDK sample code with Collections\">Cluster cluster = Cluster.connect(\"127.0.0.1\", \"Administrator\", \"password\");\r\n\r\nBucket bucket = cluster.bucket(\"bucket-name\");\r\nScope scope = bucket.scope(\"scope-name\");\r\nCollection collection = scope.collection(\"collection-name\");   \r\n\r\nJsonObject content = JsonObject.create().put(\"author\", \"mike\");\r\nMutationResult result = collection.upsert(\"document-key\", content);\r\n\r\nGetResult getResult = collection.get(\"document-key\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h3>N1QL Queries<\/h3>\n<p>Now if you want to run <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/n1ql\/query.html?ref=blog\" target=\"_blank\" rel=\"noopener\">a N1QL query<\/a> on the Collection in the above Java example, do the following:<\/p>\n<pre class=\"lang:default decode:true\" title=\"N1QL query on Scope\">\/\/run a N1QL using the context of the Scope\r\n\r\nscope.query(\"select * from collection-name\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Notice that you can query directly on a Scope. The above query on the Scope object automatically maps to `select * from bucket-name.scope-name.collection-name`.<\/p>\n<p>Another way to provide path context to N1QL is to set it on `QueryOptions`. For example:<\/p>\n<pre class=\"lang:default decode:true \" title=\"N1QL query on Collection\">QueryOptions qo = QueryOptions.queryOptions().raw(\"query_context\", \"bucket-name.scope-name\");\r\ncluster.query(\"select * from collection-name\", qo);\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A Scope may have multiple Collections, and you can join those directly by referencing the Collection name within the Scope. If you need to query across Scopes (or across Buckets), then it&#8217;s better to use the cluster object to query.<\/p>\n<p>Note that the N1QL queries no longer need to qualify a `type = foo` field (or `key_prefix` qualifier), if applicable.<\/p>\n<p>For example, this old N1QL query&#8230;<\/p>\n<pre class=\"lang:default decode:true\" title=\"Non-Collection N1QL query\">SELECT r.destinationairport\r\nFROM Travel  a \r\nJOIN Travel  r ON a.faa = r.sourceairport\r\n        AND r.type = \"route\"\r\nWHERE a.city = \"Toulouse\"\r\n        AND a.type = \"airport\";\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\u2026now becomes:<\/p>\n<pre class=\"lang:default decode:true \" title=\"New N1QL query using Collections\">SELECT r.destinationairport\r\nFROM Airport a \r\nJOIN Route r ON a.faa = r.sourceairport\r\nWHERE a.city = \"Toulouse\";\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Data Migration to Collections<\/h2>\n<p>Next, you need to migrate existing data to your new named Scopes and Collections.<\/p>\n<p>The first thing you have to determine is whether you can afford to do an offline migration (where your application is offline for a few hours), or if you need to do a mostly online migration with minimal application downtime.<\/p>\n<p>An offline migration could be faster overall and require fewer extra resources in terms of extra disk space or nodes.<\/p>\n<h3>Offline Migration<\/h3>\n<p>If you choose to do offline migration, you can use N1QL or Backup\/Restore. We&#8217;ll take a closer look at both options.<\/p>\n<h4>Using N1QL for an Offline Migration<\/h4>\n<p><strong>Prerequisite<\/strong>: Your cluster must have spare disk space and be using the Query Service.<\/p>\n<p>Following this approach, your migration would look something like the following:<\/p>\n<ol>\n<li>Create new Scopes, Collections and indexes.<\/li>\n<li>Take old application offline.<\/li>\n<li>For each named Collection:\n<ul>\n<li>Insert-Select from `_default` Collection to named Collection (using appropriate filters).<\/li>\n<li>Delete data from `_default` Collection that was migrated in above step (to save space; or if space is not an issue, you can do this at the end).<\/li>\n<\/ul>\n<\/li>\n<li>Verify your migrated data.<\/li>\n<li>Drop old Buckets.<\/li>\n<li>Online your new application.<\/li>\n<\/ol>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h4>Using Backup\/Restore for an Offline Migration<\/h4>\n<p><strong>Prerequisite<\/strong>: You need disk space to store backup files.<br \/>\nWith this approach, your migration would look like this:<\/p>\n<ol>\n<li>Create new Scopes, Collections and indexes<\/li>\n<li>Take application offline<\/li>\n<li>Take backup (`cbbackupmgr`) of 7.0 cluster<\/li>\n<li>Restore using explicit mapping to named Collections. Use `&#8211;filter-keys` and `&#8211;map-data` (see examples 1 and 2 below).<\/li>\n<li>Online your new application.<\/li>\n<\/ol>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h5>Example 1: No Filtering during Restore<\/h5>\n<p>This example moves the entire `_default` Collection to a named Collection. (This is the likely case for the consolidation scenario).<\/p>\n<pre class=\"lang:default decode:true \" title=\"Restore to named Collection with no filtering\">\/\/ Backup the default Scope of a Bucket upgraded to 7.0\r\n\r\ncbbackupmgr config -a  backup -r test-01 --include-data beer-sample._default\r\ncbbackupmgr backup -a  backup -r test-01 -c localhost -u Administrator -p password\r\n\r\n\/\/ Restore above backup to a named Collection\r\n\r\ncbbackupmgr restore -a  backup -r test-01 -c localhost -u Administrator -p password  --map-data beer-sample._default._default=beer-sample.beer-service.service_01\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h5>Example 2: Restore with Filtering<\/h5>\n<p>This example moves portions of `_default` Collection to different named Collections (This is the likely case for the splitting scenario).<\/p>\n<pre class=\"lang:default decode:true \" title=\"Restore to named Collection with filtering\">\/\/ Backup the travel-sample Bucket from a cluster upgraded to 7.0\r\n\r\ncbbackupmgr config -a  backup -r test-02 --include-data travel-sample\r\ncbbackupmgr backup -a  backup -r test-02 -c localhost -u Administrator -p password\r\n\r\n\/\/ Restore type=\u2019airport\u2019 documents to a Collection travel.booking.airport\r\ncbbackupmgr restore -a  backup -r test-02 -c localhost -u Administrator -p password  --map-data travel-sample._default._default=travel.booking.airport --auto-create-buckets --filter-values '\"type\":\"airport\"'\r\n\r\n\/\/ Restore key_prefix =\u2019airport\u2019 documents to a Collection travel.booking.airport\r\ncbbackupmgr restore -a  backup -r test-02 -c localhost -u Administrator -p password  --map-data travel-sample._default._default=travel.booking.airport --auto-create-buckets --filter-keys airport_*\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h3>Online Migration Using XDCR<\/h3>\n<p>In order to do a mostly online migration, you need to use cross data center replication (XDCR).<\/p>\n<p>Depending on your spare capacity in the existing cluster, you can do self-XDCR (where the source and destination Bucket are on the same cluster), or you can set up a separate cluster to replicate to.<\/p>\n<p>Here are the steps you need to follow:<\/p>\n<ol>\n<li>Setup XDCR from yoursource cluster to your target cluster (you can do self-XDCR if you have spare disk space and compute resources on the original cluster).<\/li>\n<li>Create new Buckets, Scopes and Collections.<\/li>\n<li>Set up replications either directly from a Bucket to a `bucket.scope.collection` or using Migration Mode (details shown below) if a single Bucket&#8217;s default Collection has to be split into multiple Collections.<\/li>\n<li>Explicit mapping rules are specifiable for each destination to specify subset of the data.<\/li>\n<li>Once replication destinations are caught up, offline your old application.<\/li>\n<li>Online your new application directing it to the new cluster (or new Bucket if using self-XDCR).<\/li>\n<li>Delete your old cluster (or your old Bucket if using self-XDCR).<\/li>\n<\/ol>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h4>Using XDCR to Migrate from Multiple Buckets to a Single Bucket<\/h4>\n<p>These steps are for the consolidation scenario.<\/p>\n<p>The XDCR set up will look something like the following:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>For each source Bucket, set up a replication to the named Collection in the destination Bucket and Scope<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The following screenshot shows the XDCR set up for one source Bucket:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRDefaultCollectionToNamedCollection.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9888\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRDefaultCollectionToNamedCollection.png\" alt=\"Using cross data center replication (XDCR) from the default Collection to a named Collection\" width=\"3256\" height=\"1326\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection.png 3256w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-300x122.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-1024x417.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-768x313.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-1536x626.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-2048x834.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-20x8.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRDefaultCollectionToNamedCollection-1320x538.png 1320w\" sizes=\"auto, (max-width: 3256px) 100vw, 3256px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h4>Using XDCR to Split to Multiple Collections from within a Single Bucket<\/h4>\n<p>These steps are for the splitting scenario.<\/p>\n<p>In order to map the source `_default` Collection to multiple target Collections, you should use the Migration Mode provided by XDCR.<\/p>\n<p>The XDCR screens below show Migration Mode being used:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRSetUp1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9889\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRSetUp1.png\" alt=\"XDCR migration mode for Couchbase 7.0\" width=\"2604\" height=\"1208\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1.png 2604w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-300x139.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-1024x475.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-768x356.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-1536x713.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-2048x950.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-20x9.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp1-1320x612.png 1320w\" sizes=\"auto, (max-width: 2604px) 100vw, 2604px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRSetUp2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9890\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/XDCRSetUp2.png\" alt=\"XDCR migration mode using mapping rules\" width=\"3202\" height=\"682\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2.png 3202w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-300x64.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-1024x218.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-768x164.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-1536x327.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-2048x436.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-20x4.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/XDCRSetUp2-1320x281.png 1320w\" sizes=\"auto, (max-width: 3202px) 100vw, 3202px\" \/><\/a><\/p>\n<p>There are four filters you need to set up: (`Travel-sample._default._default` is the source. A new Bucket called `Travel` is the target.)<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>filter `type=&#8221;airport&#8221;`, replicate to `Inventory:Airport`<\/li>\n<li>filter `type=&#8221;airline&#8221;`, replicate to `Inventory:Airline`<\/li>\n<li>filter `type=&#8221;hotel&#8221;`, replicate to `Inventory:Hotel`<\/li>\n<li>filter `type=&#8221;route&#8221;`, replicate to `Inventory:Route`<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Plan &amp; Implement Your Database Security Strategy<\/h2>\n<p>Now that you have all your data in named Scopes and Collections, you have finer control over what data you can assign privileges to. Previously you could do so only at Bucket level.<\/p>\n<p>For more information on role-based access control (RBAC) security for Scopes and Collections, read this article: <a href=\"https:\/\/www.couchbase.com\/blog\/introducing-rbac-security-for-collections\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Introducing RBAC Security for Collections<\/a> or consult the <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/manage\/manage-security\/manage-users-and-roles.html?ref=blog\" target=\"_blank\" rel=\"noopener\">documentation on RBAC<\/a>.<\/p>\n<p>The following roles are available at Scope and Collection level in Couchbase 7.<\/p>\n<p>Admin Roles:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Scope Admin role is available at the Scope level. A Scope admin can administer Collections in their Scope.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Data Reader Roles:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Data Reader<\/li>\n<li>Data Writer<\/li>\n<li>Data DCP Reader<\/li>\n<li>Data Monitoring<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Query Roles:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>FTS Searcher<\/li>\n<li>Query Select<\/li>\n<li>Query Update<\/li>\n<li>Query Insert<\/li>\n<li>Query Delete<\/li>\n<li>Query Manage Index<\/li>\n<li>Query Manage Functions<\/li>\n<li>Query Execute Functions<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Conclusion<\/h2>\n<p>I hope this guide helps you successfully migrate to Scopes and Collections in Couchbase 7.<\/p>\n<p>For more information on the 7.0 release, <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/introduction\/whats-new.html?ref=blog\" target=\"_blank\" rel=\"noopener\">check out the What&#8217;s New documentation<\/a> or <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/release-notes\/relnotes.html?ref=blog\" target=\"_blank\" rel=\"noopener\">peruse the release notes<\/a>.<\/p>\n<p>What do you think of the new Scopes and Collections feature? I look forward to hearing your feedback on <a href=\"https:\/\/www.couchbase.com\/forums\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the Couchbase Forums<\/a>.<\/p>\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?<br \/>\n<a href=\"https:\/\/www.couchbase.com\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Dig into Couchbase 7 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>Whether you&#8217;re new to Couchbase or a seasoned vet, you&#8217;ve likely heard about Scopes and Collections. If you&#8217;re ready to try them out for yourself, this article helps you make it happen. Scopes and Collections are a new feature introduced [&hellip;]<\/p>\n","protected":false},"author":31463,"featured_media":11832,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,9416,1815,1821,1816,9415,1819,1818,9336,1812,2201],"tags":[1766,2313,2103,1903,1962,2184],"ppma_author":[9079],"class_list":["post-9884","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-backup","category-best-practices-and-tutorials","category-couchbase-architecture","category-couchbase-server","category-xdcr","category-data-modeling","category-java","category-scopes-and-collections","category-n1ql-query","category-tools-sdks","tag-data-migration","tag-key-value","tag-microservices","tag-rbac","tag-role-based-access-control","tag-tco"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Couchbase Scopes and Collections: Migrate to Couchbase 7.0<\/title>\n<meta name=\"description\" content=\"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.\" \/>\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\/how-to-migrate-to-scopes-and-collections-in-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 to Migrate to Scopes &amp; Collections in Couchbase 7.0\" \/>\n<meta property=\"og:description\" content=\"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-03T07:00:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:45:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections-social.png\" \/>\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\/png\" \/>\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\/how-to-migrate-couchbase-7-scopes-collections-social.png\" \/>\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=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\"},\"author\":{\"name\":\"Shivani Gupta\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1\"},\"headline\":\"How to Migrate to Scopes &amp; Collections in Couchbase 7.0\",\"datePublished\":\"2021-09-03T07:00:50+00:00\",\"dateModified\":\"2025-06-14T03:45:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\"},\"wordCount\":1894,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png\",\"keywords\":[\"Data Migration\",\"key value\",\"microservices\",\"RBAC\",\"Role Based Access Control (RBAC)\",\"TCO\"],\"articleSection\":[\"Application Design\",\"Backup\",\"Best Practices and Tutorials\",\"Couchbase Architecture\",\"Couchbase Server\",\"Cross Data Center Replication (XDCR)\",\"Data Modeling\",\"Java\",\"Scopes and Collections\",\"SQL++ \/ N1QL Query\",\"Tools &amp; SDKs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\",\"name\":\"Couchbase Scopes and Collections: Migrate to Couchbase 7.0\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png\",\"datePublished\":\"2021-09-03T07:00:50+00:00\",\"dateModified\":\"2025-06-14T03:45:58+00:00\",\"description\":\"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png\",\"width\":1200,\"height\":628,\"caption\":\"Learn how to migrate your database model in order to use Scopes and Collections in Couchbase 7.0\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Migrate to Scopes &amp; Collections in Couchbase 7.0\"}]},{\"@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":"Couchbase Scopes and Collections: Migrate to Couchbase 7.0","description":"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.","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\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/","og_locale":"en_US","og_type":"article","og_title":"How to Migrate to Scopes &amp; Collections in Couchbase 7.0","og_description":"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.","og_url":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-09-03T07:00:50+00:00","article_modified_time":"2025-06-14T03:45:58+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections-social.png","type":"image\/png"}],"author":"Shivani Gupta","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections-social.png","twitter_misc":{"Written by":"Shivani Gupta","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/"},"author":{"name":"Shivani Gupta","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/1015706fa52f49e2e4ab139abda363b1"},"headline":"How to Migrate to Scopes &amp; Collections in Couchbase 7.0","datePublished":"2021-09-03T07:00:50+00:00","dateModified":"2025-06-14T03:45:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/"},"wordCount":1894,"commentCount":6,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png","keywords":["Data Migration","key value","microservices","RBAC","Role Based Access Control (RBAC)","TCO"],"articleSection":["Application Design","Backup","Best Practices and Tutorials","Couchbase Architecture","Couchbase Server","Cross Data Center Replication (XDCR)","Data Modeling","Java","Scopes and Collections","SQL++ \/ N1QL Query","Tools &amp; SDKs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/","url":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/","name":"Couchbase Scopes and Collections: Migrate to Couchbase 7.0","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png","datePublished":"2021-09-03T07:00:50+00:00","dateModified":"2025-06-14T03:45:58+00:00","description":"This blog post goes into detail about how you can plan your migration from an older Couchbase version to using Scopes and Collections in Couchbase 7.0.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/how-to-migrate-couchbase-7-scopes-collections.png","width":1200,"height":628,"caption":"Learn how to migrate your database model in order to use Scopes and Collections in Couchbase 7.0"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Migrate to Scopes &amp; Collections in Couchbase 7.0"}]},{"@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\/9884","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=9884"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/9884\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/11832"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=9884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=9884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=9884"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=9884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}