{"id":3151,"date":"2017-04-05T13:53:23","date_gmt":"2017-04-05T20:53:23","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=3151"},"modified":"2025-06-13T17:23:25","modified_gmt":"2025-06-14T00:23:25","slug":"document-oriented-database-n1ql","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/","title":{"rendered":"Document-Oriented Database and N1QL"},"content":{"rendered":"<p><em><u><a href=\"https:\/\/twitter.com\/@mike_aboagye\" target=\"_blank\" rel=\"noopener noreferrer\">Michael \u00a0K.<\/a><\/u><u><a href=\"https:\/\/twitter.com\/@mike_aboagye\" target=\"_blank\" rel=\"noopener noreferrer\">\u00a0Aboagy<\/a><\/u><u><a href=\"https:\/\/twitter.com\/@mike_aboagye\" target=\"_blank\" rel=\"noopener noreferrer\">e<\/a><\/u>\u00a0works as an application security engineer and web pentester with good knowledge in Linux, Git, PHP, Java, RDMS and Nosql database development. He likes to dabble in devops also.<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3152\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/MIKE-IMAGE.jpg\" alt=\"Michael K. Aboagye\" width=\"199\" height=\"199\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE.jpg 199w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-150x150.jpg 150w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-65x65.jpg 65w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-50x50.jpg 50w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-20x20.jpg 20w\" sizes=\"auto, (max-width: 199px) 100vw, 199px\" \/><\/p>\n<p><strong>Document-Oriented Database and N1QL <\/strong><\/p>\n<p>For this article, I will share my knowledge on why a document-oriented database is entirely different from a relational database management system, and why a document-oriented database performs far better than a relational database management system in a world where big data is progressing steadily. Finally, I will show how to create a document-oriented database with <a href=\"https:\/\/www.couchbase.com\/developers\/\">Couchbase<\/a> and how to use SQL syntax to run against JSON documents.<\/p>\n<p><strong>Brief Introduction to Couchbase<\/strong><\/p>\n<p>Couchbase, like MongoDB, is a NoSQL product or database system. NoSQL in this context simply means that data is stored without the aid of a structured query language; data is stored in documents. Couchbase is a combination of two products: Memcached and Couchbase.<\/p>\n<p>Couchbase combines advantages of both Memcached and Couchbase to provide scale-out performance over a cluster of nodes. Couchbase is among a number of NoSQL products which has compromised eventual consistency to place more emphasis on availability, scalability, and partition tolerance.<\/p>\n<p>According to the CAP theorem by Eric Brewer, it is impossible for distributed systems such as MongoDB or Couchbase to fulfill all the three concepts \u2013 consistency, availability, and partial tolerance. Thus, Couchbase addresses eventual consistency through its advanced replication feature, cross datacenter replication (XDCR), to effectively manage node failure, a common problem for most relational database management systems. provides a weaker form of consistency known as eventual consistency\u00a0through replication. Moreover, Couchbase has its own way of dealing with node failure which is a common problem of most relational database management systems. Couchbase implements a vBucket known as a logical partition or sharding. Each data item in a vBucket is stored on all present nodes via replication. Thus, in case of node failure, Couchbase makes one of the replica vBuckets available automatically.<\/p>\n<p>A Couchbase Server node comes with two major components \u2013 <strong>Data Manager<\/strong>\u00a0and <strong>Cluster Manager<\/strong>.<\/p>\n<p><strong>Cluster Manager<\/strong>\u00a0\u2013 is in charge of the Couchbase cluster environment. It handles the rebalancing of data between nodes, provides a cluster map that helps clients requesting particular data to know where to look for that data, monitoring nodes, gathering of statistics, and logging.<\/p>\n<p><strong>Data Manager<\/strong>\u00a0\u2013 simply manages data storage and retrieval in documents. It contains the memory cache, query engine, and disk persistence mechanism.<\/p>\n<p>Finally, Couchbase manages data in buckets. A bucket in Couchbase is similar to a database in Microsoft SQL Server or MySQL. A bucket is made up of related resources but different schemas. When there is more than one or two application\u2013driven databases, you need two buckets to manage data coming from those two applications separately.<\/p>\n<p><strong>Difference Between RDBMS and Document-Oriented Database<\/strong><\/p>\n<p>A relational database system is completely different than a document-oriented database in terms of concept and structure (schema). Moreover, a relational database is built using SQL commands which are not too difficult to code and read.<\/p>\n<p>In a relational database, tables are linked to each other through foreign keys.\u00a0Foreign key is a concept in a SQL database system whereby a foreign key consists of common fields which are used to link tables. Also, schemas in relational databases are quite rigid as compared to a document-oriented database.<\/p>\n<p>Let\u2019s assume Aero Air has a relational database to manage its flights. The database consists of three tables, namely: Flight Schedule, Flight Information, and Flight Routes.<\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Flight ID<\/span><\/td>\n<td><span style=\"font-weight: 400\">Flight Name<\/span><\/td>\n<td><span style=\"font-weight: 400\">NumSeats<\/span><\/td>\n<td><span style=\"font-weight: 400\">Distance<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">001<\/span><\/td>\n<td><span style=\"font-weight: 400\">Boeing Erv<\/span><\/td>\n<td><span style=\"font-weight: 400\">5,000<\/span><\/td>\n<td><span style=\"font-weight: 400\"> 1318km<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">002<\/span><\/td>\n<td><span style=\"font-weight: 400\">Airbus Erv<\/span><\/td>\n<td><span style=\"font-weight: 400\">1,000<\/span><\/td>\n<td><span style=\"font-weight: 400\"> 1578km<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">003<\/span><\/td>\n<td><span style=\"font-weight: 400\">Max Erv<\/span><\/td>\n<td><span style=\"font-weight: 400\">2,000<\/span><\/td>\n<td><span style=\"font-weight: 400\"> 2967km<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Routes Code<\/span><\/td>\n<td><span style=\"font-weight: 400\">Flight ID<\/span><\/td>\n<td><span style=\"font-weight: 400\">From<\/span><\/td>\n<td><span style=\"font-weight: 400\">To<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir001<\/span><\/td>\n<td><span style=\"font-weight: 400\">001<\/span><\/td>\n<td><span style=\"font-weight: 400\">Glasgow<\/span><\/td>\n<td><span style=\"font-weight: 400\">Paris<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir002<\/span><\/td>\n<td><span style=\"font-weight: 400\">002<\/span><\/td>\n<td><span style=\"font-weight: 400\">Brussels<\/span><\/td>\n<td><span style=\"font-weight: 400\">Bengaluru<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir003<\/span><\/td>\n<td><span style=\"font-weight: 400\">003<\/span><\/td>\n<td><span style=\"font-weight: 400\">Hamburg<\/span><\/td>\n<td><span style=\"font-weight: 400\">Moscow<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Schedule Code<\/span><\/td>\n<td><span style=\"font-weight: 400\">Flight ID<\/span><\/td>\n<td><span style=\"font-weight: 400\">Dep Time<\/span><\/td>\n<td><span style=\"font-weight: 400\">Arrival Time<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir-010<\/span><\/td>\n<td><span style=\"font-weight: 400\">001<\/span><\/td>\n<td><span style=\"font-weight: 400\">1700 GMT<\/span><\/td>\n<td><span style=\"font-weight: 400\">2000 GMT<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir-012<\/span><\/td>\n<td><span style=\"font-weight: 400\">002<\/span><\/td>\n<td><span style=\"font-weight: 400\">1600 GMT<\/span><\/td>\n<td><span style=\"font-weight: 400\">1300 GMT<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">AeroAir-013<\/span><\/td>\n<td><span style=\"font-weight: 400\">003<\/span><\/td>\n<td><span style=\"font-weight: 400\">1400 GMT<\/span><\/td>\n<td><span style=\"font-weight: 400\">1400 GMT<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In a document-oriented database, schema of a database differs in every document in a database. A document-oriented database allows dynamic schema; thus a document may contain a specific field or key different from other documents. In a typical document database, SQL commands are not allowed. However, you can use N1QL, also referred to as \u201cNickel,\u201d to run SQL against your documents.<\/p>\n<p>N1QL is a specific query language for Couchbase that allows you to bring both worlds of NoSQL and SQL together. You can use N1QL to run against a JSON document, a feature that makes N1QL interesting, which we will explore later.<\/p>\n<p>For our previous example of <strong>Aero Air<\/strong>\u00a0database of flights, we can do the same using Couchbase by naming our bucket \u201cAeroAir\u201d to manage the stored data. Through the <strong>AeroAir<\/strong>\u00a0<strong>bucket<\/strong>, Couchbase developers can edit data in documents.<\/p>\n<p><strong>Creating a Document-Oriented Database with Couchbase <\/strong><\/p>\n<p>Creating a document-oriented database iwith Couchbase requires basic knowledge in JSON format.<\/p>\n<p>First, let\u2019s assume you have already installed Couchbase Server (eitherEnterprise edition or Community edition).<\/p>\n<p>Here is an overview of Couchbase Server:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/Overview.png\" alt=\"Overview\" width=\"1005\" height=\"604\" \/><\/p>\n<p><strong>How to Create a Bucket in Couchbase<\/strong><\/p>\n<p>Before you can create documents, you need to create a bucket to manage stored data. You can enter in any name you prefer; I chose to name the bucket <strong>AeroAir<\/strong>.\u00a0<img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/Image-2.png\" alt=\"Image 2\" \/><\/p>\n<p>As you can see, we have one active bucket,\u00a0which is the AeroAir bucket.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/Active-bucket-1.png\" alt=\"Active bucket 1\" \/><\/p>\n<p>Now let\u2019s assume AeroAir has a simple document made up of flight details relevant to travelers or customers.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/DOCUMENT-1.png\" alt=\"DOCUMENT 1\" \/><\/p>\n<p>Remember,\u00a0a document-oriented database is entirely different and quite flexible in comparison to\u00a0a relational database belonging to the SQL\u00a0family. With a document-oriented database, you can include extra fields in other documents as well as\u00a0exclude them.<\/p>\n<p>Let\u2019s create a flight document for Boeing ERV. On the far right AeroAir, you can see that there are two buttons labeled <strong>Documents<\/strong>\u00a0and<strong>\u00a0View<\/strong>.<strong>\u00a0<\/strong>Click in the document button to create a new flight document for our AeroAir bucket.<\/p>\n<p>You create a new document by editing predefined data in JSON format with your own data.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/PREDINE.png\" alt=\"PREDINE\" \/><\/p>\n<p>As you can see, I have created a flight document for Boeing ERV in the AeroAir bucket.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/new-doc.png\" alt=\"new doc\" \/><\/p>\n<p>In addition, I have created four documents in the AeroAir bucket. Each document represents flight information data, flight schedule data, and route information. You can go on to create as many documents as you want for the AeroAir bucket.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/new-doc-set.png\" alt=\"new doc set\" \/><\/p>\n<p>Below is an illustration of how data in a document looks. Leaving a trailing comma in a JSON document is considered valid\u00a0unless the comma in the last element precedes the closing tag.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/json-example.png\" alt=\"json example\" \/><\/p>\n<p>When you include an additional comma, you are notified of a JSON error. Check out the example below:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/JSON-ERROR.png\" alt=\"JSON ERROR\" \/><\/p>\n<p>As stated earlier, with a document-oriented database you can input fields which are absent in some documents but present in other documents. It does not affect the database entirely because a document-oriented database has a very flexible schema. Check the example between flight Boeing ERV and Boeing FFH.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/Beoing-ERV-example.png\" alt=\"Beoing ERV example\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/Boeing-ffh-example.png\" alt=\"Boeing ffh example\" \/><\/p>\n<p>As you can see, although both documents are in the AeroAir bucket, one document has a field which is absent in another document, yet our database or bucket is not affected.<\/p>\n<p>In Couchbase, accessing data in a document is quite different from a relational database where you rely on primary key to retrieve a particular value in a row. In Couchbase you can use the Document_ID of a document to access a specific document in a bucket once the document ID is valid and the document exists. Similar to a relational database, a document ID should be unique.<\/p>\n<p>Thus, in our AeroAir database example, I used the name of the flights as document ID.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/DOCU-id.png\" alt=\"DOCU id\" \/><\/p>\n<p>Now that we have created documents in the AeroAir data, it is time for us to query our documents.<\/p>\n<p>Couchbase provides the N1QL query language, which is similar to SQL syntax, but it can operate on JSON documents and results are returned in JSON format.<\/p>\n<p>Basic knowledge in MySQL or generally SQL is enough to take you through the basics and probably towards advanced N1QL commands. Like SQL, N1QL consists of data manipulation language and data definition language.<\/p>\n<p>Basically, I will use clauses such as SELECT, WHERE, and FROM to query documents in AeroAir. Like SQL, N1QL offers more than <strong>SELECT<\/strong>, <strong>FROM<\/strong>, and <strong>WHERE<\/strong>.\u00a0For instance, you can use the UPDATE clause if you want to update a value in your document, or INSERT if you want to include new data.<\/p>\n<p>Once you know SQL syntax off hand, using Couchbase N1QL against JSON documents should not be a problem.<\/p>\n<p>We will just focus on how to <strong>SELECT<\/strong>, <strong>FROM<\/strong>,\u00a0and <strong>WHERE<\/strong>\u00a0using the following clauses to query documents in AeroAir using Couchbase N1QL.<\/p>\n<p><strong>SELECT<\/strong>\u00a0\u2013\u00a0You can use this clause to select a specific field in a document, including an asterisk symbol after the SELECT clause returns all fields in documents.<\/p>\n<p><strong>FROM <\/strong><strong>\u2013<\/strong><strong>\u00a0<\/strong>You can use this clause to the data bucket to work with or operate on.<\/p>\n<p><strong>WHERE <\/strong><strong>\u2013<\/strong>\u00a0You\u00a0can use this clause indicating conditions that retrieved documents must have or satisfy.<\/p>\n<p>Couchbase provides a Query Workbench to run queries in the web console and a cbq tool if you prefer to use the command line.<\/p>\n<p><strong>Using the Query Workbench<\/strong><\/p>\n<p>Now that we have some documents in our buckets, let\u2019s try some basic queries on one or two documents.<\/p>\n<p>First and foremost, click on the <strong>QUERY<\/strong>\u00a0tab next to the <strong>INDEXES<\/strong>\u00a0tab or in between <strong>DATA BUCKETS<\/strong>\u00a0and <strong>INDEXES<\/strong>.<strong>\u00a0<\/strong>As you can see, there is a bucket analysis which shows the current bucket being managed by the system. Also on the right, there is the result panel showing where the returned result in JSON format is displayed.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/queryaeroair.png\" alt=\"queryaeroair\" \/><\/p>\n<p>I have certain fields in the documents to make our query runs more interesting. Let\u2019s say we are interested in a flight fixed with internet Wi-Fi. Running query in the web console without creating a primary index on the bucket <strong>AeroAir <\/strong>ends up as error.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/create-index.png\" alt=\"create index\" \/><\/p>\n<p>Now try running the same query in the web console. You can see that this time around the query executed successfully.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/flightname.png\" alt=\"flightname\" \/><\/p>\n<p>You can see that the results are returned in JSON format. We queried for a flight with internet speed more than 100 kbps. It returned the Boeing FFH flight as the only flight satisfying the query condition. The comparison operator simply means <strong>greater than 100 kilobytes per second. <\/strong><\/p>\n<p>You can specify a particular condition without using comparison operators. Let\u2019s say we want find out which flight has Jack Charisma assigned as the head pilot<strong>. <\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/jacvkcharism-a.png\" alt=\"jacvkcharism a\" \/><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p>Interestingly, although <a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/\">N1QL<\/a> uses SQL syntax, it can run against JSON documents. This is what makes Couchbase with N1QL interesting and a better alternative to a relational database.<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/community\/community-writers-program\/\"><em>This post is part of the Couchbase Community Writing Program<\/em><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Michael \u00a0K.\u00a0Aboagye\u00a0works as an application security engineer and web pentester with good knowledge in Linux, Git, PHP, Java, RDMS and Nosql database development. He likes to dabble in devops also. Document-Oriented Database and N1QL For this article, I will share [&hellip;]<\/p>\n","protected":false},"author":53,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816,1812],"tags":[1572],"ppma_author":[9026],"class_list":["post-3151","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server","category-n1ql-query","tag-database"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Document-Oriented Database and N1QL - The Couchbase Blog<\/title>\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\/document-oriented-database-n1ql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Document-Oriented Database and N1QL\" \/>\n<meta property=\"og:description\" content=\"Michael \u00a0K.\u00a0Aboagye\u00a0works as an application security engineer and web pentester with good knowledge in Linux, Git, PHP, Java, RDMS and Nosql database development. He likes to dabble in devops also. Document-Oriented Database and N1QL For this article, I will share [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-05T20:53:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T00:23:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"199\" \/>\n\t<meta property=\"og:image:height\" content=\"199\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Laura Czajkowski, Developer Community Manager, 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=\"Laura Czajkowski, Developer Community Manager, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\"},\"author\":{\"name\":\"Laura Czajkowski, Developer Community Manager, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220\"},\"headline\":\"Document-Oriented Database and N1QL\",\"datePublished\":\"2017-04-05T20:53:23+00:00\",\"dateModified\":\"2025-06-14T00:23:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\"},\"wordCount\":1774,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"database\"],\"articleSection\":[\"Couchbase Server\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\",\"name\":\"Document-Oriented Database and N1QL - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-04-05T20:53:23+00:00\",\"dateModified\":\"2025-06-14T00:23:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#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\/document-oriented-database-n1ql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Document-Oriented Database and N1QL\"}]},{\"@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\/5f1a0ece4e644bc8c037686fbc8f3220\",\"name\":\"Laura Czajkowski, Developer Community Manager, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9deb07d5daaa00220534c31768bc4409\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g\",\"caption\":\"Laura Czajkowski, Developer Community Manager, Couchbase\"},\"description\":\"Laura Czajkowski is the Snr. Developer Community Manager at Couchbase overseeing the community. She\u2019s responsible for our monthly developer newsletter.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/laura-czajkowski\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Document-Oriented Database and N1QL - The Couchbase Blog","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\/document-oriented-database-n1ql\/","og_locale":"en_US","og_type":"article","og_title":"Document-Oriented Database and N1QL","og_description":"Michael \u00a0K.\u00a0Aboagye\u00a0works as an application security engineer and web pentester with good knowledge in Linux, Git, PHP, Java, RDMS and Nosql database development. He likes to dabble in devops also. Document-Oriented Database and N1QL For this article, I will share [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-04-05T20:53:23+00:00","article_modified_time":"2025-06-14T00:23:25+00:00","og_image":[{"width":199,"height":199,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE.jpg","type":"image\/jpeg"}],"author":"Laura Czajkowski, Developer Community Manager, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Laura Czajkowski, Developer Community Manager, Couchbase","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/"},"author":{"name":"Laura Czajkowski, Developer Community Manager, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220"},"headline":"Document-Oriented Database and N1QL","datePublished":"2017-04-05T20:53:23+00:00","dateModified":"2025-06-14T00:23:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/"},"wordCount":1774,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["database"],"articleSection":["Couchbase Server","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/","url":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/","name":"Document-Oriented Database and N1QL - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-04-05T20:53:23+00:00","dateModified":"2025-06-14T00:23:25+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/document-oriented-database-n1ql\/#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\/document-oriented-database-n1ql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Document-Oriented Database and N1QL"}]},{"@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\/5f1a0ece4e644bc8c037686fbc8f3220","name":"Laura Czajkowski, Developer Community Manager, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9deb07d5daaa00220534c31768bc4409","url":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","caption":"Laura Czajkowski, Developer Community Manager, Couchbase"},"description":"Laura Czajkowski is the Snr. Developer Community Manager at Couchbase overseeing the community. She\u2019s responsible for our monthly developer newsletter.","url":"https:\/\/www.couchbase.com\/blog\/author\/laura-czajkowski\/"}]}},"authors":[{"term_id":9026,"user_id":53,"is_guest":0,"slug":"laura-czajkowski","display_name":"Laura Czajkowski, Developer Community Manager, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","author_category":"","last_name":"Czajkowski","first_name":"Laura","job_title":"","user_url":"","description":"Laura Czajkowski is the Snr. Developer Community Manager at Couchbase overseeing the community. She\u2019s responsible for our monthly developer newsletter."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3151","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\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=3151"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3151\/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=3151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=3151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=3151"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=3151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}