{"id":4160,"date":"2017-10-31T12:15:21","date_gmt":"2017-10-31T19:15:21","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=4160"},"modified":"2025-06-13T23:43:17","modified_gmt":"2025-06-14T06:43:17","slug":"n1ql-enhancements-couchbase-server-5","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/","title":{"rendered":"N1QL Enhancements in Couchbase Server 5.0"},"content":{"rendered":"<div class=\"paragraph\">\n<p>N1QL enhancements have come to Couchbase. N1QL is one of the flagship features of Couchbase Server. The release of <a href=\"https:\/\/www.couchbase.com\/downloads\/\">Couchbase Server 5.0<\/a> further bolsters N1QL with a range of enhancements.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Many of these enhancements have been covered in previous blog posts (such as <a href=\"https:\/\/www.couchbase.com\/blog\/n1ql-performance-feature-enhancements-couchbase-5-0\/\">Nic Raboy&#8217;s post on performance enhancements<\/a>). This post won&#8217;t cover all the N1QL enhancements. Check out <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/introduction\/whats-new.html\">What&#8217;s New? in Couchbase<\/a> for the full scoop.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><em>Important notes: To follow along, you can install <a href=\"https:\/\/www.couchbase.com\/downloads\/\">Couchbase Server 5.0<\/a> on your local machine. You can also explore <strong>some<\/strong> of these N1QL Enhancements without even installing Couchbase Server by checking out the <a href=\"https:\/\/www.couchbase.com\/blog\/learn-n1ql-10-minutes-interactive-online-tutorial\/\">10 minute online tutorial<\/a>. Also, this blog is being written with a release candidate build of Couchbase Server that may differ slightly from the actual release.<\/em><\/p>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_n1ql_enhancements_for_rbac\">N1QL Enhancements for RBAC<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>One of the biggest new features in Couchbase Server 5.0 is the built-in Role Based Access Control (RBAC). For the full story, you can check out <a href=\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\">previous blog posts on RBAC<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>But, from a N1QL enhancements point of view, there are two keywords you should know about: <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/n1ql\/n1ql-language-reference\/grant.html#topic_11_5\">GRANT<\/a> and <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/n1ql\/n1ql-language-reference\/revoke.html#topic_11_5\">REVOKE<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The documentation covers it well, but here&#8217;s a quick example. I&#8217;ll create a user &#8220;myuser&#8221;, and give that user only one role: Data Reader on the &#8220;travel-sample&#8221; bucket.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08501-create-user.png\" alt=\"Create a user with N1QL enhancements\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>I could edit that user in the UI to give them Data Writer.<\/p>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_grant_and_revoke\">GRANT and REVOKE<\/h3>\n<div class=\"paragraph\">\n<p>But here&#8217;s how to do it with a <code>GRANT<\/code> N1QL command:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-sql\">GRANT data_writer\r\n ON `travel-sample`\r\n TO myuser;<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>After, you can navigate over to the &#8220;Security&#8221; section of Couchbase Console to see that &#8220;myuser&#8221; has the new permission.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08502-grant-user-role-n1ql-enhancements.png\" alt=\"GRANT a role to a user as a N1QL enhancement\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can find all of the role names (like &#8220;data_writer&#8221;) in the <a href=\"https:\/\/docs.couchbase.com\/server\/5.0\/security\/concepts-rbac-for-apps.html\">5.0 documentation<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><code>REVOKE<\/code> works the same way, but in reverse.<\/p>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"__code_system_code_keyspaces_for_rbac\"><code>system<\/code> keyspaces for RBAC<\/h3>\n<div class=\"paragraph\">\n<p>There are a couple of <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/monitoring\/monitoring-n1ql-query.html\">new system keyspaces<\/a> that are part of the 5.0 N1QL enhancements. <code>SELECT * FROM system:user_info<\/code> will return information about each user and their roles.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08503-user-info-keyspace.png\" alt=\"User info keyspace\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can use <code>SELECT * FROM system:applicable_roles<\/code> keyspace to get a list of all the role information.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Note that only Adminstrators and users with a &#8220;Query System Catalog&#8221; role themselves have access to these keyspaces.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_curl\">curl<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>As <a href=\"https:\/\/www.couchbase.com\/blog\/curl-comes-n1ql-querying-external-json-data\/\">Isha blogged about earlier<\/a>, you can now use a CURL function from N1QL to query external JSON data. There are definitely security implications when using CURL, so make sure to read the full <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/n1ql\/n1ql-language-reference\/curl.html#topic_8_8\">N1QL CURL documentation<\/a> before you decide to use this N1QL enhancement.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Before I can use CURL, I have to add a URL to a whitelist. On Windows, this is done by creating a file in the \/var\/lib\/couchbase\/n1qlcerts folder (I had to create the n1qlcerts folder myself too) called curl_whitelist.json. <em>The full default path for your reference is: C:\\Program Files\\Couchbase\\Server\\var\\lib\\couchbase\\n1qlcerts\\curl_whitelist.json.<\/em><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>I created a file with a single URL entry (swapi.co is the Star Wars API):<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-JavaScript\">{\r\n\t\"all_access\": false,\r\n\t\"allowed_urls\": [\"https:\/\/swapi.co\"]\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Then, you can use the <code>CURL<\/code> function from with a N1QL query to retrieve JSON data. You could retrieve a single planet, for instance, with <a href=\"https:\/\/swapi.co\/api\/planets\/3\/\" class=\"bare\">https:\/\/swapi.co\/api\/planets\/3\/<\/a>, or you could retrieve all the planets (which is what I did):<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-SQL\">SELECT p.name, p.climate, p.residents\r\nFROM CURL(\"https:\/\/swapi.co\/api\/planets\/\").results as p;<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>That endpoint returns 10 planets at a time. I&#8217;m narrowing it just to the <code>results<\/code> field, and to the name, climate, and residents.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08504-curl-result-in-n1ql.png\" alt=\"CURL result in N1QL\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Note that CURL to a query also introduces other issues: you are yielding performance and reliability to the external data source. Also note that you can use CURL on Couchbase Server&#8217;s own REST API, which opens up a lot of interesting possibilities.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_indexes\">Indexes<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>As always, good indexing is vital to getting optimal performance from your N1QL queries. There are a lot of index options in Couchbase Server, which I won&#8217;t cover in this blog post. Definitely <a href=\"https:\/\/www.couchbase.com\/blog\/gear-n1ql-era-engagement-databases\/\">check out this blog post from Prasad Varakur<\/a> and also look at some of the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/performance\/index_pushdowns.html\">optimizations<\/a> that have been added to Couchbase in version 5.0.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>For this post, I&#8217;m just going to touch on the new <strong>adaptive indexes<\/strong> and <strong>equivalent indexes<\/strong>.<\/p>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_adaptive_indexes\">Adaptive Indexes<\/h3>\n<div class=\"paragraph\">\n<p>In previous versions of Couchbase, if you wanted to index combinations of fields, you had to create an index for each combination. For example, if I plan to write queries that check &#8220;type&#8221; and &#8220;name&#8221; field together or the &#8220;type&#8221; and &#8220;age&#8221; field together, that would require two compound indexes: one for <code>type,name<\/code> and one for <code>type,state<\/code>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Consider this query:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-SQL\">SELECT l.*\r\nFROM `travel-sample` l\r\nWHERE l.type='landmark'\r\nAND l.state='California';<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>In the default <code>travel-sample<\/code> bucket, the <code>type<\/code> field is indexed, but not the state. This query works, but notice how flat the query plan is:<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08505-index-no-adaptive.png\" alt=\"Query without adaptive index\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Also notice that the &#8220;fetch&#8221; and &#8220;filter&#8221; steps have to process almost 4500 documents.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Adaptive indexes make it easier to write indexes that better support adhoc querying. They can be used to index specified fields or all fields of a document.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>A new keyword introduced by this round of N1QL enhancements is <code>SELF<\/code>. It can create an adaptive index on all fields in all &#8216;landmark&#8217; documents in the travel-sample bucket like so:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-SQL\">CREATE INDEX `ai_n1ql_enhancements`\r\n    ON `travel-sample`(DISTINCT PAIRS(SELF))\r\n    WHERE type = 'landmark';<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><em>You can also specify individual fields you want to index instead of <code>SELF<\/code>.<\/em><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>After creating this index, run the above <code>SELECT<\/code> query again.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08506-index-with-adaptive.png\" alt=\"Query with adaptive index\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Notice the extra index scanning that&#8217;s occurring to accommodate the <code>state<\/code> field that it&#8217;s querying on. Also notice that &#8220;filter&#8221; and &#8220;fetch&#8221; are working through fewer documents: only 1900. With the relative small size of the &#8220;travel-sample&#8221; bucket, this is an overall small savings. With a <em>real<\/em> bucket containing millions of documents, the time saved can be significant.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Further, as your queries grow more complex, <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/n1ql\/n1ql-language-reference\/adaptive-indexing.html\">adaptive indexes<\/a> will save you work while still giving you a performance boost.<\/p>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_index_replicas\">Index Replicas<\/h3>\n<div class=\"paragraph\">\n<p>If you are making heavy use of N1QL in your application, you may want to create multiple indexes that get distributed across your cluster. These N1QL enhancements can improve performance, load balancing, and availability.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Until Couchbase Server 5, the way you did this was to create multiple identical indexes with different name. As Venkat covered in this <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-index-replicas\/\">earlier blog post on index replicas<\/a>, there are some drawbacks to that.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>So, in Couchbase Server 5, index replicas have been introduced. When creating an index, simply use a <code>num_replica<\/code> setting to specify how many replica indexes you want to create.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Here&#8217;s an index on the <code>state<\/code> field that I was using earlier in the &#8220;travel-sample&#8221; bucket. In this case, I&#8217;m going to replicate it twice.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-SQL\">CREATE INDEX `ix_state`\r\n    ON `travel-sample`(state)\r\n    WHERE state IS NOT MISSING\r\n    WITH {\"num_replica\":2};<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Note that in order for this to work, you&#8217;ll need at least three nodes running the index service (1 for the index, 2 for the replicas).<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>After running the above query (on a 3 node cluster), click &#8220;Indexes&#8221;. You should see &#8220;ix_state&#8221; show up 3 times on three nodes. Two of them are marked &#8220;replica&#8221;.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08507-index-replicas.png\" alt=\"Index replicas\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><em>You can also specify the exact nodes you want the replicas on by specifying IP addresses in <code>CREATE INDEX<\/code>.<\/em><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Couchbase will take care of the rest for you. Index replicas will be used for incoming queries.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>If you&#8217;re not new to Couchbase, check out this <a href=\"https:\/\/www.couchbase.com\/blog\/transition-index-replicas\/\">guide on transitioning from &#8220;equivalent indexes&#8221; to index replicas<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>For more details, definitely check out <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-index-replicas\/\">Venkat&#8217;s blog post on index replicas<\/a> and the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/indexes\/index-replication.html\">Couchbase Server 5.0 documentation on index replication<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_monitoring\">Monitoring<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>The most difficult task in writing N1QL queries is making sure they are efficient and performant. To that end, Couchbase Server 5.0 has introduced a number of features to help you monitor and profile your queries.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Way back in March, I wrote about the new <a href=\"https:\/\/www.couchbase.com\/blog\/profiling-monitoring-update\/\">query plan visualization<\/a>. I also wrote about the <a href=\"https:\/\/www.couchbase.com\/blog\/new-profiling-monitoring-couchbase-server-4-6\/\">new system keyspaces<\/a> for monitoring queries.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can get the full story on the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/5.0\/monitoring\/monitoring-n1ql-query.html#topic_nvs_ghr_dz\">Monitoring N1QL Queries<\/a> documentation page.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>For this post, I just want to do a quick refresher. If you click the &#8220;Plan&#8221; button in Query Workbench, you&#8217;ll see a graphic representation of the query plan. You can get a visual guide to which parts of the query take the most time. For instance, the query plan for the above <code>SELECT<\/code> query:<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08508-visual-query-plan.png\" alt=\"Visual N1QL query plan\"><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>There are a couple more N1QL enhancements to remind you about as well. Two new system keyspaces: <code>system:completed_requests<\/code> and <code>system:active_requests<\/code>. These keyspaces contain information about queries that have run or are currently running: how much time they take, errors, which nodes they run on, and so forth. A quick example:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-SQL\">SELECT r.node\r\nFROM system:completed_requests r;<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Since I have index replicas, this query could have run on different nodes. The results show that they did:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-JavaScript\">[\r\n  {\r\n    \"node\": \"10.142.173.101:8091\"\r\n  },\r\n  {\r\n    \"node\": \"10.142.173.101:8091\"\r\n  },\r\n  {\r\n    \"node\": \"10.142.173.103:8091\"\r\n  },\r\n  {\r\n    \"node\": \"10.142.173.103:8091\"\r\n  },\r\n  \/\/ ... etc ...\r\n]<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Be sure to check out the other <a href=\"https:\/\/www.couchbase.com\/blog\/tooling-improvements-couchbase-5-beta\/\">tooling updates<\/a> in Couchbase Server 5.0. It&#8217;s not just N1QL that&#8217;s getting enhancements.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_summary\">Summary<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>N1QL is one of Couchbase Server&#8217;s major strengths, and Couchbase is committed to creating valuable N1QL enhancements.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>If you&#8217;ve not used N1QL yet, why not try the <a href=\"https:\/\/www.couchbase.com\/blog\/learn-n1ql-10-minutes-interactive-online-tutorial\/\">10 minute online tutorial<\/a> today?<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Got questions or comments? Find me on <a href=\"https:\/\/twitter.com\/mgroves\">Twitter @mgroves<\/a> or email me <a href=\"mailto:matthew.groves@couchbase.com\">matthew.groves@couchbase.com<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>N1QL enhancements have come to Couchbase. N1QL is one of the flagship features of Couchbase Server. The release of Couchbase Server 5.0 further bolsters N1QL with a range of enhancements. Many of these enhancements have been covered in previous blog [&hellip;]<\/p>\n","protected":false},"author":71,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,1816,1812],"tags":[],"ppma_author":[8937],"class_list":["post-4160","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-couchbase-server","category-n1ql-query"],"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>N1QL Enhancements in Couchbase Server 5.0 - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.\" \/>\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\/n1ql-enhancements-couchbase-server-5\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"N1QL Enhancements in Couchbase Server 5.0\" \/>\n<meta property=\"og:description\" content=\"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-31T19:15:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T06:43:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08501-create-user.png\" \/>\n<meta name=\"author\" content=\"Matthew Groves\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mgroves\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matthew Groves\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\"},\"author\":{\"name\":\"Matthew Groves\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\"},\"headline\":\"N1QL Enhancements in Couchbase Server 5.0\",\"datePublished\":\"2017-10-31T19:15:21+00:00\",\"dateModified\":\"2025-06-14T06:43:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\"},\"wordCount\":1442,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\".NET\",\"Couchbase Server\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\",\"name\":\"N1QL Enhancements in Couchbase Server 5.0 - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-10-31T19:15:21+00:00\",\"dateModified\":\"2025-06-14T06:43:17+00:00\",\"description\":\"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#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\/n1ql-enhancements-couchbase-server-5\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"N1QL Enhancements in Couchbase Server 5.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\/3929663e372020321b0152dc4fa65a58\",\"name\":\"Matthew Groves\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"caption\":\"Matthew Groves\"},\"description\":\"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.\",\"sameAs\":[\"https:\/\/crosscuttingconcerns.com\",\"https:\/\/x.com\/mgroves\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/matthew-groves\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"N1QL Enhancements in Couchbase Server 5.0 - The Couchbase Blog","description":"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.","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\/n1ql-enhancements-couchbase-server-5\/","og_locale":"en_US","og_type":"article","og_title":"N1QL Enhancements in Couchbase Server 5.0","og_description":"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.","og_url":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-10-31T19:15:21+00:00","article_modified_time":"2025-06-14T06:43:17+00:00","og_image":[{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/10\/08501-create-user.png","type":"","width":"","height":""}],"author":"Matthew Groves","twitter_card":"summary_large_image","twitter_creator":"@mgroves","twitter_misc":{"Written by":"Matthew Groves","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/"},"author":{"name":"Matthew Groves","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58"},"headline":"N1QL Enhancements in Couchbase Server 5.0","datePublished":"2017-10-31T19:15:21+00:00","dateModified":"2025-06-14T06:43:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/"},"wordCount":1442,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":[".NET","Couchbase Server","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/","url":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/","name":"N1QL Enhancements in Couchbase Server 5.0 - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-10-31T19:15:21+00:00","dateModified":"2025-06-14T06:43:17+00:00","description":"There are many N1QL enhancements in the new Couchbase Server 5.0 release. This blog post will help you to scratch the surface.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-enhancements-couchbase-server-5\/#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\/n1ql-enhancements-couchbase-server-5\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"N1QL Enhancements in Couchbase Server 5.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\/3929663e372020321b0152dc4fa65a58","name":"Matthew Groves","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54","url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","caption":"Matthew Groves"},"description":"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.","sameAs":["https:\/\/crosscuttingconcerns.com","https:\/\/x.com\/mgroves"],"url":"https:\/\/www.couchbase.com\/blog\/author\/matthew-groves\/"}]}},"authors":[{"term_id":8937,"user_id":71,"is_guest":0,"slug":"matthew-groves","display_name":"Matthew Groves","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","author_category":"","last_name":"Groves","first_name":"Matthew","job_title":"","user_url":"https:\/\/crosscuttingconcerns.com","description":"Matthew D. Groves is a guy who loves to code.  It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything.  He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s.  He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community.  He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4160","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\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=4160"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4160\/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=4160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=4160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=4160"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=4160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}