{"id":11705,"date":"2021-08-23T00:00:26","date_gmt":"2021-08-23T07:00:26","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=11705"},"modified":"2025-06-13T21:23:04","modified_gmt":"2025-06-14T04:23:04","slug":"get-started-nodejs-sdk-couchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/","title":{"rendered":"How to Get Started with the Node.js SDK for Couchbase"},"content":{"rendered":"<p><strong>In just a few lines of code<\/strong> you can start using Couchbase with Node.js to build your next JavaScript application.<\/p>\n<p>This <em>hello world<\/em> tutorial walks you through the basic first steps of using <a href=\"https:\/\/developer.couchbase.com\/topic\/nodejs\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the Node.js SDK<\/a> with the <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-server-7-0-release\/?ref=blog\" target=\"_blank\" rel=\"noopener\">latest features of Couchbase 7.0<\/a>. It assumes you have at least some familiarity with both JavaScript and <a href=\"https:\/\/www.couchbase.com\/resources\/why-nosql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">NoSQL databases<\/a> \u2013 but expertise isn&#8217;t required.<\/p>\n<h2>Install &amp; Prepare Couchbase<\/h2>\n<p>Before you dive into developing an application, start by setting up <a href=\"https:\/\/couchbase.com\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the latest version of Couchbase Server<\/a> or <a href=\"https:\/\/cloud.couchbase.com\/sign-up?ref=blog\" target=\"_blank\" rel=\"noopener\">sign up for free a Couchbase Cloud account<\/a>.<\/p>\n<p>After installation, set up the `travel-sample` Bucket which creates a set of sample documents with flights, hotels, landmarks and more. You&#8217;ll find this data handy for testing a range of different kinds of applications.<\/p>\n<h2>Set Up a Basic Node.js Application<\/h2>\n<p>For the rest of this post, I&#8217;ll assume you already have Node.js installed along with your favorite code editing tools. (First-time developers should look up some basic tutorials to get a working environment.)<\/p>\n<p>Your first step is to create a project folder and initialize the package template with <code>npm init -y<\/code>, as shown below:<\/p>\n<pre>tyler@local:~\/src\/cb-node$ npm init -y\r\nWrote to \/home\/tyler\/src\/cb-node\/package.json:\r\n\r\n{\r\n\"name\": \"cb-node\",\r\n\"version\": \"1.0.0\",\r\n\"description\": \"\",\r\n\"main\": \"index.js\",\r\n\"scripts\": {\r\n\"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n},\r\n\"keywords\": [],\r\n\"author\": \"\",\r\n\"license\": \"ISC\"\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Add the Couchbase Node.js Module Dependency<\/h2>\n<p>Next, add the Couchbase Node.js module to the dependencies in <code>package.json<\/code> by running the <code>npm install<\/code> command with the <code>--save<\/code> option, like so:<\/p>\n<pre>$ npm install couchbase --save\r\n&gt; couchbase@3.2.0 install \/home\/tyler\/src\/cb-node\/node_modules\/couchbase\r\n&gt; prebuild-install || node-gyp rebuild\r\n\r\n...\r\n\r\nnpm WARN cb-node@1.0.0 No description\r\nnpm WARN cb-node@1.0.0 No repository field.\r\n\r\n+ couchbase@3.2.0\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The <code>package.json<\/code> file now has the dependency section:<\/p>\n<pre>\"dependencies\": {\r\n\"couchbase\": \"^3.2.0\"\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Connect to a Couchbase Cluster<\/h2>\n<p>To test that the modules are all installed properly \u2013 and that you can connect to the cluster \u2013 you need to know the Bucket name in order to connect to and add a user that can access the Couchbase Bucket.<\/p>\n<pre>var couchbase = require(\"couchbase\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>For the most simplistic usage, wrap the rest of the example in a connect function:<\/p>\n<pre>couchbase.connect(\r\n  'couchbase:\/\/127.0.0.1',\r\n  {\r\n    username: 'Administrator',\r\n    password: 'Administrator'\r\n  },\r\n...)\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>You also need to select the keyspace \u2013 i.e., <a href=\"https:\/\/www.couchbase.com\/blog\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Scope or Collection(s)<\/a> \u2013 you want to access, if applicable. In this initial test case, we&#8217;ll use a default Collection which ignores Scopes and Collections altogether:<\/p>\n<pre>...\r\n(err, cluster) =&gt; {\r\n  var bucket = cluster.bucket('travel-sample')\r\n  var coll = bucket.defaultCollection()\r\n...\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Get a JSON Document<\/h2>\n<p>There are thousands of sample <a href=\"https:\/\/www.couchbase.com\/blog\/json-database\/?ref=blog\" target=\"_blank\" rel=\"noopener\">JSON<\/a> documents in the <code>travel-sample<\/code> Bucket.<\/p>\n<p>To request a document using basic key-value operations, use the <code>get<\/code> function and supply a document ID. You can use the web console to browse for a given hotel document to get the ID, as pictured below.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/08\/cb_document_hotel_5336.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-11706\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/08\/cb_document_hotel_5336-1024x629.png\" alt=\"A JSON document visible in the Couchbase Web Console\" width=\"900\" height=\"553\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/cb_document_hotel_5336-1024x629.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/cb_document_hotel_5336-300x184.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/cb_document_hotel_5336-768x472.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/cb_document_hotel_5336-20x12.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/cb_document_hotel_5336.png 1216w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Catch the response and error, then print to console to see if it is successful.<\/p>\n<pre class=\"\">coll.get('hotel_5336', (err, res) =&gt; {\r\n  if (err) throw err\r\n  console.log(res.value)\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>If you made it this far and it&#8217;s your first Node.js app, congratulations! You now know how to get a document from Couchbase with the most simple syntax. The full code sample is below:<\/p>\n<pre>var couchbase = require('couchbase')\r\n\r\ncouchbase.connect(\r\n  'couchbase:\/\/127.0.0.1',\r\n  {\r\n    username: 'Administrator',\r\n    password: 'Administrator'\r\n  },\r\n  (err, cluster) =&gt; {\r\n    var bucket = cluster.bucket('travel-sample')\r\n    var coll = bucket.defaultCollection()\r\n\r\n    coll.get('hotel_5336', (err, res) =&gt; {\r\n      if (err) throw err\r\n      console.log(res.value)\r\n    })\r\n  }\r\n)\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Keep in mind this is a basic example that includes blocking code. In a future article, I&#8217;ll cover an example that shows non-blocking async examples instead.<\/p>\n<h2>Create or Upsert a Document Using JavaScript<\/h2>\n<p>To create a new document you can use the <code>upsert<\/code> function. It&#8217;s called <code>upsert<\/code> because it acts like an insert (for new documents) or if there is already a document with the same ID, it will simply update it.<\/p>\n<p>Ensure that the user you specify has adequate write privileges before trying an `upsert`. The examples below assume full Bucket administrative access to keep things simple.<\/p>\n<p>At this point, copy your script into a new file for testing the <code>upsert<\/code> functionality independent from the <code>get<\/code> function.<\/p>\n<p><code>Upsert<\/code> requires a document ID and a JSON object with the document data. You provide the ID when pushing it to the database. Create the variable to hold the JSON data and add some elements to it.<\/p>\n<pre>newdoc = {\r\n  type: \"hotel\",\r\n  id: 2,\r\n  name: \"Le Grande\",\r\n  city: \"Paris, France\"\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Next, call the <code>upsert<\/code> function along with the new document ID.<\/p>\n<pre>coll.upsert('hotel_2', newdoc, (err, res) =&gt; {\r\n  console.log(res)\r\n})\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Print the output to show that a mutation\/transaction has completed. The <code>CAS<\/code> value is used in other contexts to compare vintage of the data for tracking\/locking different data versions.<\/p>\n<p>Running the script produces the following transaction summary:<\/p>\n<pre class=\"\">$ node app.js\r\n\r\nMutationResult {\r\ncas: CbCas&lt;1628915917601505280&gt;,\r\ntoken: CbMutationToken&lt;4:251812459673841:85:travel-sample&gt; }\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Now you can go back to your original `get` script and drop in the new document ID to test that it can now be retrieved.<\/p>\n<p>Here is the full script for doing the simple `upsert` in a standalone Node.js script.<\/p>\n<pre class=\"\">var couchbase = require('couchbase')\r\n\r\ncouchbase.connect(\r\n  'couchbase:\/\/127.0.0.1',\r\n  {\r\n    username: 'Administrator',\r\n    password: 'Administrator'\r\n  },\r\n  (err, cluster) =&gt; {\r\n    var bucket = cluster.bucket('travel-sample')\r\n    var coll = bucket.defaultCollection()\r\n\r\n    newdoc = {\r\n      type: \"hotel\",\r\n      id: 2,\r\n      name: \"Le Grande\",\r\n      city: \"Paris, France\"\r\n    }\r\n\r\n    coll.upsert('hotel_2', newdoc, (err, res) =&gt; {\r\n      console.log(\"Hotel added\")\r\n      console.log(res)\r\n    })\r\n  }\r\n)\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Conclusion<\/h2>\n<p>Thank you for following along with these basic JavaScript with Couchbase examples. I hope this gets you started with building a NoSQL application using Node.js.<\/p>\n<p>For more SDK-related examples <a target=\"_blank\" rel=\"noopener\">check out the Node.js SDK documentation<\/a>. In future posts, we&#8217;ll explore using the functions asynchronously and dig into other Couchbase functions like query and search.<\/p>\n<p><em>Catch up with the rest of the Node.js + Couchbase how-to series:<\/em><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">How to Get Started with the Node.js SDK for Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/how-to-create-nodejs-async-get-upsert-calls-with-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">How to Create Async Get\/Upsert Calls with Node.js and Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/build-a-rest-api-with-node-js-express-and-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Build a REST-Based Application with Node.js, Express and Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/how-to-query-json-data-n1ql-node-js-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">How to Query JSON Data Using N1QL for Node.js and Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/how-to-full-text-search-javascript-app\/?ref=blog\" target=\"_blank\" rel=\"noopener\">How to Add Full-Text Search Functionality to Your JavaScript App<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 30px\" aria-hidden=\"true\"><\/div>\n<div style=\"text-align: center\"><strong>Want to try out these examples for yourself?&lt;br\/ &gt;<a href=\"https:\/\/cloud.couchbase.com\/sign-up?ref=blog\" target=\"_blank\" rel=\"noopener\">Sign Up for Couchbase Cloud Today<\/a><\/strong><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In just a few lines of code you can start using Couchbase with Node.js to build your next JavaScript application. This hello world tutorial walks you through the basic first steps of using the Node.js SDK with the latest features [&hellip;]<\/p>\n","protected":false},"author":75185,"featured_media":11748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816,9327,1822,2201],"tags":[6311,1543,1261,2313,1725,9317],"ppma_author":[9163],"class_list":["post-11705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server","category-javascript","category-node-js","category-tools-sdks","tag-couchbase-cloud","tag-javascript","tag-json","tag-key-value","tag-nosql-database","tag-upsert"],"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>Node.js SDK for Couchbase: Build Next JavaScript Application<\/title>\n<meta name=\"description\" content=\"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.\" \/>\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\/get-started-nodejs-sdk-couchbase\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Started with the Node.js SDK for Couchbase\" \/>\n<meta property=\"og:description\" content=\"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-23T07:00:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T04:23:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started-social.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"418\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@1tylermitchell\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\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\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/\"},\"author\":{\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/684cc0e5c60cd2e4b591db9621494ed0\"},\"headline\":\"How to Get Started with the Node.js SDK for Couchbase\",\"datePublished\":\"2021-08-23T07:00:26+00:00\",\"dateModified\":\"2025-06-14T04:23:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/\"},\"wordCount\":815,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2021\\\/08\\\/nodejs-sdk-javascript-couchbase-get-started.png\",\"keywords\":[\"Couchbase Cloud\",\"javascript\",\"JSON\",\"key value\",\"NoSQL Database\",\"upsert\"],\"articleSection\":[\"Couchbase Server\",\"JavaScript\",\"Node.js\",\"Tools &amp; SDKs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/\",\"name\":\"Node.js SDK for Couchbase: Build Next JavaScript Application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2021\\\/08\\\/nodejs-sdk-javascript-couchbase-get-started.png\",\"datePublished\":\"2021-08-23T07:00:26+00:00\",\"dateModified\":\"2025-06-14T04:23:04+00:00\",\"description\":\"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2021\\\/08\\\/nodejs-sdk-javascript-couchbase-get-started.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2021\\\/08\\\/nodejs-sdk-javascript-couchbase-get-started.png\",\"width\":1200,\"height\":628,\"caption\":\"Learn how to use the Node.js SDK for Couchbase in this simple JavaScript developer tutorial\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/get-started-nodejs-sdk-couchbase\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Get Started with the Node.js SDK for Couchbase\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/684cc0e5c60cd2e4b591db9621494ed0\",\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=gd8a7c532bf2b94b7a2fe7a8439aafd75\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"caption\":\"Tyler Mitchell - Senior Product Marketing Manager\"},\"description\":\"Works as Senior Product Marketing Manager at Couchbase, helping bring knowledge about products into the public limelight while also supporting our field teams with valuable content.\",\"sameAs\":[\"https:\\\/\\\/linkedin.com\\\/in\\\/tylermitchell\",\"https:\\\/\\\/x.com\\\/1tylermitchell\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCBZFuoiTcg0f3lGSQwLjeTg\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/author\\\/tylermitchell\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Node.js SDK for Couchbase: Build Next JavaScript Application","description":"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.","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\/get-started-nodejs-sdk-couchbase\/","og_locale":"en_US","og_type":"article","og_title":"How to Get Started with the Node.js SDK for Couchbase","og_description":"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.","og_url":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-08-23T07:00:26+00:00","article_modified_time":"2025-06-14T04:23:04+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started-social.png","type":"image\/png"}],"author":"Tyler Mitchell - Senior Product Marketing Manager","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started-social.png","twitter_creator":"@1tylermitchell","twitter_misc":{"Written by":"Tyler Mitchell - Senior Product Marketing Manager","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/"},"author":{"name":"Tyler Mitchell - Senior Product Marketing Manager","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0"},"headline":"How to Get Started with the Node.js SDK for Couchbase","datePublished":"2021-08-23T07:00:26+00:00","dateModified":"2025-06-14T04:23:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/"},"wordCount":815,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started.png","keywords":["Couchbase Cloud","javascript","JSON","key value","NoSQL Database","upsert"],"articleSection":["Couchbase Server","JavaScript","Node.js","Tools &amp; SDKs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/","url":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/","name":"Node.js SDK for Couchbase: Build Next JavaScript Application","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started.png","datePublished":"2021-08-23T07:00:26+00:00","dateModified":"2025-06-14T04:23:04+00:00","description":"Walk through the basic first steps of using the Node.js SDK with the latest features of Couchbase 7.0. Familiarity is assumed but expertise is not required.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/08\/nodejs-sdk-javascript-couchbase-get-started.png","width":1200,"height":628,"caption":"Learn how to use the Node.js SDK for Couchbase in this simple JavaScript developer tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/get-started-nodejs-sdk-couchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Get Started with the Node.js SDK for Couchbase"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0","name":"Tyler Mitchell - Senior Product Marketing Manager","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=gd8a7c532bf2b94b7a2fe7a8439aafd75","url":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","caption":"Tyler Mitchell - Senior Product Marketing Manager"},"description":"Works as Senior Product Marketing Manager at Couchbase, helping bring knowledge about products into the public limelight while also supporting our field teams with valuable content.","sameAs":["https:\/\/linkedin.com\/in\/tylermitchell","https:\/\/x.com\/1tylermitchell","https:\/\/www.youtube.com\/channel\/UCBZFuoiTcg0f3lGSQwLjeTg"],"url":"https:\/\/www.couchbase.com\/blog\/author\/tylermitchell\/"}]}},"acf":[],"authors":[{"term_id":9163,"user_id":75185,"is_guest":0,"slug":"tylermitchell","display_name":"Tyler Mitchell - Senior Product Marketing Manager","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/876da1e4284f1832c871b3514caf7867357744b8c0a370ef6f53a79dee2f379e?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\/11705","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\/75185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=11705"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/11705\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/11748"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=11705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=11705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=11705"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=11705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}