{"id":2111,"date":"2017-01-03T02:42:51","date_gmt":"2017-01-03T02:42:50","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2111"},"modified":"2019-05-07T10:43:35","modified_gmt":"2019-05-07T17:43:35","slug":"couchbase-mobile-part-2-couchbase-lite-views-indexes","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/","title":{"rendered":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)"},"content":{"rendered":"<p><em>This blog was originally posted on Roi Katz&#8217;s personal blog site. Please <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/\">click here<\/a> to find the original post.<\/em><\/p>\n<p>In the <a href=\"https:\/\/roikatz.blogspot.co.il\/2015\/12\/couchbase-mobile-part-1-couchbase-lite.html\">part 1<\/a> we&#8217;ve built our tiny yet cool application, we&#8217;ve even replicated it to another Couchbase Lite.<\/p>\n<p>But what now? We want to actually use it!<\/p>\n<p>So how do we use a database? well at least with &#8220;getting&#8221; the data you have couple of options:<\/p>\n<ol>\n<li>Get by primary key<\/li>\n<li>Get by an index (or &#8220;selecting&#8221; it where x)<\/li>\n<\/ol>\n<p>Up until now, in our simple sample app we could only use the &#8220;primary key&#8221; to access our data and retrieve it.<\/p>\n<p>But it&#8217;s not the only way to get you data from Couchbase Lite.<\/p>\n<p>In this part we will learn the basics of Couchbase Lite indexing. AKA Views.<\/p>\n<p>On the the views, we run our Queries.<\/p>\n<p>So we need to:<\/p>\n<ol>\n<li>Create View<\/li>\n<li>Run Queries on the view<\/li>\n<li>Get the results<\/li>\n<\/ol>\n<p>We will build\u00a0our use case &#8211; of how using &#8220;views&#8221; in Couchbase Lite.<\/p>\n<ol>\n<li>Start a new WPF project.<\/li>\n<\/ol>\n<div class=\"separator\" style=\"color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18.2px; clear: both; text-align: center;\"><a style=\"text-decoration: none; color: #015782; margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-VBIWYykibXU\/VoKC4cVZv_I\/AAAAAAAAStA\/WseHli7iNE8\/s1600\/Screen%2BShot%2B2015-12-29%2Bat%2B14.55.37.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border: 1px solid #cccccc; position: relative; padding: 8px; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; border-radius: 0px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;\" src=\"https:\/\/3.bp.blogspot.com\/-VBIWYykibXU\/VoKC4cVZv_I\/AAAAAAAAStA\/WseHli7iNE8\/s320\/Screen%2BShot%2B2015-12-29%2Bat%2B14.55.37.png\" width=\"320\" height=\"221\" border=\"0\" \/><\/a><\/div>\n<ol start=\"2\">\n<li>Add Nuget Couchbase.Lite package<\/li>\n<\/ol>\n<div class=\"separator\" style=\"color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18.2px; clear: both; text-align: center;\"><a style=\"text-decoration: none; color: #015782; margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/4.bp.blogspot.com\/-Zg2g-SyYOo0\/VoKDUMLpr6I\/AAAAAAAAStI\/UGVisAnQZ6A\/s1600\/Screen%2BShot%2B2015-12-29%2Bat%2B13.17.15.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border: 1px solid #cccccc; position: relative; padding: 8px; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; border-radius: 0px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;\" src=\"https:\/\/4.bp.blogspot.com\/-Zg2g-SyYOo0\/VoKDUMLpr6I\/AAAAAAAAStI\/UGVisAnQZ6A\/s320\/Screen%2BShot%2B2015-12-29%2Bat%2B13.17.15.png\" width=\"320\" height=\"158\" border=\"0\" \/><\/a><\/div>\n<ol start=\"3\">\n<li>Copy that XAML<\/li>\n<\/ol>\n<pre><code style=\"word-wrap: normal;\">   \r\n     \r\n       \r\n         \r\n         \r\n       \r\n       \r\n         \r\n         \r\n       \r\n       \r\n       <button><\/button>  \r\n       <button><\/button>  \r\n       <button><\/button>  \r\n       \r\n       \r\n         \r\n          \r\n       \r\n       \r\n       <button><\/button>  \r\n         \r\n       \r\n     \r\n   \r\n<\/code><\/pre>\n<p>Which translates to<\/p>\n<table class=\"tr-caption-container\" style=\"padding: 4px; margin-bottom: 0.5em; position: relative; color: #333333; line-height: 18.2px; margin-left: auto; margin-right: auto; background-color: #ffffff;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td><a style=\"text-decoration: none; color: #015782; margin-left: auto; margin-right: auto;\" href=\"https:\/\/2.bp.blogspot.com\/-q6F2g3thBRY\/VokYk3RJKwI\/AAAAAAAAUCA\/FCaUPDUIXo8\/s1600\/Screen%2BShot%2B2016-01-03%2Bat%2B14.47.11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border: 1px solid #cccccc; position: relative; padding: 8px; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; border-radius: 0px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;\" title=\"GUI generates form the XAML above\" src=\"https:\/\/2.bp.blogspot.com\/-q6F2g3thBRY\/VokYk3RJKwI\/AAAAAAAAUCA\/FCaUPDUIXo8\/s400\/Screen%2BShot%2B2016-01-03%2Bat%2B14.47.11.png\" alt=\"\" width=\"400\" height=\"223\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"font-size: 10.4px;\">GUI generates form the XAML above<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"4\">\n<li>After you got the basic UI, which you can explore later (nothing much here really), lets go the the actual code.<\/li>\n<\/ol>\n<p>After we started all up, and Initialized the Database let us define our views.<\/p>\n<p>In this case I&#8217;ve defined 1 view &#8211; just to show how to set things up.<\/p>\n<pre><code style=\"word-wrap: normal;\">     private void GenerateViews()  \r\n     {  \r\n       var docsByCity = _database.GetView(\"docs_by_city\");  \r\n       docsByCity.SetMap((doc, emit) =&gt;  \r\n       {  \r\n         if (doc.ContainsKey(\"City\"))  \r\n         {  \r\n           emit(doc[\"City\"], doc);  \r\n         }  \r\n       }, \"1\");  \r\n     }  \r\n<\/code><\/pre>\n<p>What you can see here, that once I retrieve a name from the _database I can define a map on it, a map is basically a projection and filtering.<\/p>\n<p>In the example above, I&#8217;ve created a view named &#8220;docs_by_city&#8221;, assigned a delegate, checked if some key (&#8220;City&#8221;) exist and then emitted it to the index. Simple as that.<\/p>\n<p>We&#8217;ve just created our index which for every document contains a property named City &#8211; it emits the whole document, you can choose to emit whatever you want, depends on app&#8217;s requirements.<\/p>\n<p>It can be adjusted for better performance and smaller index size.<\/p>\n<p>Also you can put as your key about any string you would like or compose your index from several properties to target special needs.<\/p>\n<p style=\"margin-left: 40px;\"><strong>It&#8217;s never good to store the entire document in the index as it basically make a copy of the document inside the index. Try to keep your index as small as possible. But if you happen to need some kind of index which has the entire document as a result, for performance it&#8217;s better to keep the document in the index instead of accessing the result.Document property &#8211; to same some round tripping to the database. <\/strong><\/p>\n<p>The number &#8220;1&#8221; here, it the version of the index.\u00a0During development if you change the map function you also need to increment that number (in case you haven&#8217;t deleted the whole database), in order to rebuild the index.<\/p>\n<p>There are 2 special queries.<\/p>\n<ol>\n<li>Get all documents count. (with _database.DocumentCount)<\/li>\n<li>Get all documents. (with _database.CreateAllDocumentsQuery())<\/li>\n<\/ol>\n<p>After we defined our view (*index) we can start writing the code and use it.<\/p>\n<ol>\n<li>The usage, is fairly simple only 5 steps.<\/li>\n<li>Get the view<\/li>\n<li>Create a query on the view<\/li>\n<li>Define your criteria on the index<\/li>\n<li>Run it<\/li>\n<li>Read it<\/li>\n<\/ol>\n<p>In code it\u00a0looks even simpler:<\/p>\n<pre><code style=\"word-wrap: normal;\">      private void GetByCityClick(object sender, RoutedEventArgs e)  \r\n     {  \r\n       var docsByCity = _database.GetView(\"docs_by_city\");  \r\n       var query = docsByCity.CreateQuery();  \r\n\r\n       query.StartKey = City;  \r\n       query.EndKey = City;  \r\n\r\n       var queryResults = query.Run();  \r\n       MessageBox.Show(string.Format(\"{0} documents has been retrieved for that query\", queryResults.Count));\r\n\r\n       if (queryResults.Count == 0) return;  \r\n\r\n       var documents = queryResults.Select(result =&gt; JsonConvert.SerializeObject(result.Value, Formatting.Indented)).ToArray();  \r\n       var commaSeperaterdDocs = \"[\" + string.Join(\",\", documents) + \"]\";  \r\n\r\n       DocumentText = commaSeperaterdDocs;  \r\n     }  \r\n<\/code><\/pre>\n<div>I want the exact &#8220;City&#8221; so i&#8217;ve written on start and end key the same value.<\/div>\n<p>I run the query and check if there is any results.<\/p>\n<p>Then I &#8220;beautify&#8221; the result (for every value) and return that as a JSON array.<\/p>\n<p><strong>Please pay attention here that I&#8217;m not using result.Document but result.Value, as using the result.Document will not use the index and will go and query the database for each result. <\/strong><\/p>\n<p><strong>So for performance, please use result.key, result.value or result.DocumentId. <\/strong><\/p>\n<p>Now just add that part to generate some data&#8230;<\/p>\n<pre><code style=\"word-wrap: normal;\">   private void InsertSomeDataClick(object sender, RoutedEventArgs e)  \r\n     {  \r\n       var result = MessageBox.Show(\"Press Yes to insert some data (10 docs)!\", \"Confirm\", MessageBoxButton.YesNo);  \r\n       if (result == MessageBoxResult.Yes)  \r\n       {  \r\n         var count = _database.DocumentCount;  \r\n         string[] cities = { \"London\", \"New York\", \"Tel Aviv\" };  \r\n         var rnd = new Random();  \r\n         for (int i = 0; i &lt; 10; i++)  \r\n         {  \r\n           var id = \"document\" + (i + count);  \r\n           var cityIndex = rnd.Next(0, 3);  \r\n   \r\n           var properties = new Dictionary&lt;string, string&gt;();  \r\n           properties.Add(\"name\", \"Roi Katz\");  \r\n           properties.Add(\"City\", cities[cityIndex]);  \r\n             \r\n           var doc = JsonConvert.SerializeObject(properties);  \r\n           InsertDocument(id, doc);  \r\n         }   \r\n         MessageBox.Show(\"10 Records inserted\");  \r\n       }  \r\n     }  <\/code><\/pre>\n<p>And we are good to go!<\/p>\n<p>This is how we do a simple view!<\/p>\n<p>Of course we have more to come on Couchbase lite views, it&#8217;s just the start.<\/p>\n<p>Of course we do need to create the proper properties, so for full project, please check my <a href=\"https:\/\/github.com\/roikatz\/CouchbaseLite_Views\/tree\/master\/CouchbaseLiteViews_Blog\">GitHub<\/a> page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog was originally posted on Roi Katz&#8217;s personal blog site. Please click here to find the original post. In the part 1 we&#8217;ve built our tiny yet cool application, we&#8217;ve even replicated it to another Couchbase Lite. But what [&hellip;]<\/p>\n","protected":false},"author":64,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1810],"tags":[],"ppma_author":[8938],"class_list":["post-2111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-mobile"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)<\/title>\n<meta name=\"description\" content=\"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.\" \/>\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\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)\" \/>\n<meta property=\"og:description\" content=\"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-03T02:42:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-07T17:43:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Roi Katz, Solution Architect, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Roi Katz, Solution Architect, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/\"},\"author\":{\"name\":\"Roi Katz, Solution Architect, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/8e452408f0a3793ded90eea9263a264e\"},\"headline\":\"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)\",\"datePublished\":\"2017-01-03T02:42:50+00:00\",\"dateModified\":\"2019-05-07T17:43:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/\"},\"wordCount\":706,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Couchbase Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/\",\"name\":\"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-03T02:42:50+00:00\",\"dateModified\":\"2019-05-07T17:43:35+00:00\",\"description\":\"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-mobile-part-2-couchbase-lite-views-indexes\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)\"}]},{\"@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\\\/8e452408f0a3793ded90eea9263a264e\",\"name\":\"Roi Katz, Solution Architect, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g5eb805f4c05de24c77c276f241a51b53\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g\",\"caption\":\"Roi Katz, Solution Architect, Couchbase\"},\"description\":\"Roi is a Couchbase Solution Architect, software developer and architect with over 10 years of broad industry experience. He has been a trainer and author of courses with a specialization in Big Data Systems, NoSQL Databases, Couchbase, Distributed Architecture and Cloud Computing.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/author\\\/roi-katz\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)","description":"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.","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\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/","og_locale":"en_US","og_type":"article","og_title":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)","og_description":"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.","og_url":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-01-03T02:42:50+00:00","article_modified_time":"2019-05-07T17:43:35+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Roi Katz, Solution Architect, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Roi Katz, Solution Architect, Couchbase","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/"},"author":{"name":"Roi Katz, Solution Architect, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/8e452408f0a3793ded90eea9263a264e"},"headline":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)","datePublished":"2017-01-03T02:42:50+00:00","dateModified":"2019-05-07T17:43:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/"},"wordCount":706,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Couchbase Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/","name":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-03T02:42:50+00:00","dateModified":"2019-05-07T17:43:35+00:00","description":"The blog covers learning the basics of Couchbase Lite indexing. AKA Views. It also explains how to do simple views, how to run queries.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-part-2-couchbase-lite-views-indexes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Couchbase Mobile Part 2: Couchbase Lite Views (Indexes!)"}]},{"@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\/8e452408f0a3793ded90eea9263a264e","name":"Roi Katz, Solution Architect, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g5eb805f4c05de24c77c276f241a51b53","url":"https:\/\/secure.gravatar.com\/avatar\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g","caption":"Roi Katz, Solution Architect, Couchbase"},"description":"Roi is a Couchbase Solution Architect, software developer and architect with over 10 years of broad industry experience. He has been a trainer and author of courses with a specialization in Big Data Systems, NoSQL Databases, Couchbase, Distributed Architecture and Cloud Computing.","url":"https:\/\/www.couchbase.com\/blog\/author\/roi-katz\/"}]}},"acf":[],"authors":[{"term_id":8938,"user_id":64,"is_guest":0,"slug":"roi-katz","display_name":"Roi Katz, Solution Architect, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/a22c6493bc51fd783319cc905789337f163df1de53c7bad6d769c9560be0ba3c?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2111","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\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2111"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2111"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}