{"id":1966,"date":"2021-07-20T03:47:56","date_gmt":"2021-07-20T10:47:56","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/using-java-sdk-for-couchbase-basics-get-upsert\/"},"modified":"2021-07-20T03:47:56","modified_gmt":"2021-07-20T10:47:56","slug":"using-java-sdk-for-couchbase-basics-get-upsert","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ko\/using-java-sdk-for-couchbase-basics-get-upsert\/","title":{"rendered":"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert"},"content":{"rendered":"\n<p><strong>Using Java with Couchbase doesn&#8217;t have to be hard,<\/strong> even for a new developer.<\/p>\n\n\n\n<p>In this quickstart tutorial, we&#8217;re going to walk through the basics of creating and fetching JSON documents in Couchbase <a href=\"https:\/\/developer.couchbase.com\/topic\/java\/?ref=blog\" target=\"_blank\" rel=\"noopener\">using the Java SDK<\/a>. With minimalist code samples, you can be connecting and testing your application right away.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set Up a Basic Java Application<\/h2>\n\n\n\n<p>Before you get started, make sure you have <a href=\"https:\/\/www.couchbase.com\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">the most recent version of Couchbase installed<\/a>, along with the travel-sample bucket.<\/p>\n\n\n\n<p>Naturally, we need a basic Java development environment too. To set up a development environment on a new computer, consider using the <a href=\"https:\/\/code.visualstudio.com\/docs\/java\/java-tutorial\">Coding Pack for Java<\/a> from Microsoft.<\/p>\n\n\n\n<p>This package is handy because it helps install the JDK along with supporting extensions for the Visual Studio Code environment. I used OpenJDK 11 for my configuration and set it as my main <code>JAVA_HOME<\/code> once I downloaded it with their GUI.<\/p>\n\n\n\n<p>The Java Tools get started page was helpful to create a new project, select Maven build tools and specify a project folder. I select all the default values and the Maven project is automatically created under the <code>JAVA PROJECTS<\/code> file explorer and called demo.<\/p>\n\n\n\n<p>Open the <code>demo -&gt; src\/main\/java -&gt; com.example -&gt; App<\/code> file.<\/p>\n\n\n\n<p>Run a test build to ensure Java is configured properly, using the Play button at the top right of the editor. The output terminal window should show:<\/p>\n\n\n\n<p><code>Hello World!<\/code><\/p>\n\n\n\n<p>That confirms that Java is running properly and that your environment is ready to go.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Couchbase java-client Dependency for Maven<\/h2>\n\n\n\n<p>Add the Couchbase <code>java-client<\/code> dependency from <code>com.couchbase.client<\/code>, version 3.1.6 as a Maven dependency in the <code>pom.xml<\/code> file.<\/p>\n\n\n\n<p>If using a GUI to do this, be careful to get <code>java-client<\/code> and not <code>couchbase-client<\/code> libraries.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    \r\n      com.couchbase.client\r\n      java-client\r\n      3.1.6\r\n    \r\n<\/code><\/pre>\n\n\n\n<p>Adding imports from the Couchbase Java SDK (in the code sample below) enables the cluster connection classes for your project. We&#8217;ll add more throughout this exercise, but feel free to skip to the full code sample at the end of the post.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import com.couchbase.client.java.*;\r\n<\/code><\/pre>\n\n\n\n<p>Add a basic cluster connection string to <code>main()<\/code>, as you see in the example below. Connection parameters include the IP address or the name of a node in the Couchbase cluster along with the username\/password. Note that I use my main administrator login here for simplicity because it has full permissions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    public static void main( String[] args )\r\n    {\r\n        System.out.println( &quot;Hello World!&quot; );\r\n        Cluster cluster = Cluster.connect(&quot;192.168.0.158&quot;,&quot;Administrator&quot;,&quot;Administrator&quot;);\r\n    }\r\n<\/code><\/pre>\n\n\n\n<p>When you have the connection info entered, run another test build and the output should show that a node was connected:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>INFO: [com.couchbase.node][NodeConnectedEvent] Node connected {&quot;coreId&quot;:&quot;0x9bb7352900000001&quot;,&quot;managerPort&quot;:&quot;8091&quot;,&quot;remote&quot;:&quot;192.168.0.158\/&quot;}\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Get a Document<\/h2>\n\n\n\n<p>If you made it this far, you&#8217;re more than halfway there!<\/p>\n\n\n\n<p>Next, we&#8217;re going to request a specific document using its ID. Document IDs are unique names for every document in the bucket or collection of documents in a bucket.<\/p>\n\n\n\n<p>The travel-sample bucket that comes with <a href=\"https:\/\/www.couchbase.com\/products\/capella\/\" target=\"_blank\" rel=\"noopener\">Couchbase<\/a> includes airlines, hotels, and more \u2013 all so you can test your code on real data.<\/p>\n\n\n\n<p>The image below shows how you can browse available documents in a bucket using the web console.<\/p>\n\n\n\n<figure id=\"attachment_11533\" aria-describedby=\"caption-attachment-11533\" style=\"width: 768px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/07\/couchbase-document-viewer.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium_large wp-image-11533\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer-768x432-1.png\" alt=\"Couchbase web UI showing document viewer\" width=\"768\" height=\"432\"><\/a><figcaption id=\"caption-attachment-11533\" class=\"wp-caption-text\">Couchbase document viewer in the web console<\/figcaption><\/figure>\n\n\n\n<p>To access documents in the database, we need some more classes that interact with key-value operations like getting and setting documents.<\/p>\n\n\n\n<p>Here&#8217;s how you add import for key-value operations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import com.couchbase.client.java.kv.GetResult;\r\n<\/code><\/pre>\n\n\n\n<p>Next, you need to define a collection and bucket to connect to and provide a document ID to fetch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>        Bucket bucket = cluster.bucket(&quot;travel-sample&quot;);\r\n        Collection collection = bucket.defaultCollection();\r\n\r\n        \/\/ Get a Document\r\n        GetResult getResult = collection.get(&quot;airline_10&quot;);\r\n        System.out.println(getResult);\r\n<\/code><\/pre>\n\n\n\n<p>Scopes and collections are used to group similar types of documents for different applications. In this example, we just use the defaults that include everything.<\/p>\n\n\n\n<p>Be more precise if you want. For example, you can just print the name of the document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String name = getResult.contentAsObject().getString(&quot;name&quot;);\r\nSystem.out.println(name);\r\n<\/code><\/pre>\n\n\n\n<p>Run this code and the output will show the raw JSON of the document, plus the above string taken from the name field:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{&quot;country&quot;:&quot;United States&quot;,&quot;iata&quot;:&quot;Q5&quot;,&quot;name&quot;:&quot;40-Mile Air&quot;,&quot;callsign&quot;:&quot;MILE-AIR&quot;,&quot;icao&quot;:&quot;MLA&quot;,&quot;id&quot;:10,&quot;type&quot;:&quot;airline&quot;}\r\n\r\n40-Mile Air\r\n<\/code><\/pre>\n\n\n\n<p>That&#8217;s all it takes to fetch a specific document. Congratulations if you made it this far!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create or Upsert a Document<\/h2>\n\n\n\n<p>Creating a document isn&#8217;t much harder than fetching one.<\/p>\n\n\n\n<p>Ensure that your user settings allow you to create new documents in the given bucket. Then we&#8217;ll add a couple imports and build a simple JSON document that we send\/insert\/update\/upsert into the database.<\/p>\n\n\n\n<p>While we aren&#8217;t going to do anything fancy with tracking versions of documents or related mutations, the SDK does return the status of the operation for us to use later on. Here&#8217;s how to add a couple more imports to handle the update of documents and create JSON objects:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import com.couchbase.client.java.kv.MutationResult;\r\nimport com.couchbase.client.java.json.*;\r\n<\/code><\/pre>\n\n\n\n<p>Then we add code for creating a basic document, including any field you want in the JSON document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>        MutationResult upsertResult = collection.upsert(\r\n            &quot;airbnb_1&quot;,\r\n            JsonObject.create().put(&quot;name&quot;, &quot;Tyler&#039;s AirBnB&quot;)\r\n                .put(&quot;country&quot;, &quot;Canada&quot;)\r\n                .put(&quot;type&quot;, &quot;hotel&quot;)\r\n        );\r\n<\/code><\/pre>\n\n\n\n<p>Note that an ID is provided (<code>airbnb_1<\/code>) and then the JSON document is formed and submitted to the database (<code>upsert<\/code>) all in one command. Note that the ID itself is not part of the JSON but is a string passed to the function.<\/p>\n\n\n\n<p>An upsert will create a new document if none exists, or update any existing ones with the same ID.<\/p>\n\n\n\n<p>Now let&#8217;s change the original document fetch to get the new document we just created:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GetResult getResult = collection.get(&quot;airbnb_1&quot;);\r\n<\/code><\/pre>\n\n\n\n<p>The terminal log should print the raw result object and then the name from our new document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GetResult{content={&quot;name&quot;:&quot;Tyler&#039;s AirBnB&quot;,&quot;type&quot;:&quot;hotel&quot;,&quot;country&quot;:&quot;Canada&quot;}, flags=0x2000000, cas=0x16917e1447b40000, expiry=Optional.empty}\r\nTyler&#039;s AirBnB\r\n<\/code><\/pre>\n\n\n\n<p>And that&#8217;s it!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next Steps<\/h2>\n\n\n\n<p>This simple tutorial should get you started with the Couchbase Java SDK quickly. Future posts in this series will examine other services such as Query and Full-Text Search.<\/p>\n\n\n\n<p>For more information, <a href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/hello-world\/start-using-sdk.html?ref=blog\">check out the Couchbase Java SDK documentation that covers similar concepts.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Full Couchbase Client Code Example<\/h3>\n\n\n<p>[crayon lang=&#8221;java&#8221; decode=&#8221;true&#8221;]package com.example;<\/p>\n<p>import com.couchbase.client.java.*;<br \/>\nimport com.couchbase.client.java.kv.GetResult;<br \/>\nimport com.couchbase.client.java.kv.MutationResult;<br \/>\nimport com.couchbase.client.java.json.*;<\/p>\n<p>public class App<br \/>\n{<br \/>\n    public static void main( String[] args )<br \/>\n    {<br \/>\n        System.out.println( &#8220;Hello World!&#8221; );<br \/>\n        Cluster cluster = Cluster.connect(&#8220;192.168.0.158&#8243;,&#8221;Administrator&#8221;,&#8221;Administrator&#8221;);<br \/>\n        Bucket bucket = cluster.bucket(&#8220;travel-sample&#8221;);<br \/>\n        Collection collection = bucket.defaultCollection();<\/p>\n<p>        MutationResult upsertResult = collection.upsert(<br \/>\n            &#8220;airbnb_1&#8221;,<br \/>\n            JsonObject.create().put(&#8220;name&#8221;, &#8220;Tyler&#8217;s AirBnB&#8221;)<br \/>\n                .put(&#8220;country&#8221;, &#8220;Canada&#8221;)<br \/>\n                .put(&#8220;type&#8221;, &#8220;hotel&#8221;)<br \/>\n        );<\/p>\n<p>        \/\/ Get a Document<br \/>\n        \/\/GetResult getResult = collection.get(&#8220;airline_10&#8221;);<br \/>\n        GetResult getResult = collection.get(&#8220;airbnb_1&#8221;);<br \/>\n        System.out.println(getResult);<\/p>\n<p>        \/\/ Print specific field in document results<br \/>\n        String name = getResult.contentAsObject().getString(&#8220;name&#8221;);<br \/>\n        System.out.println(name);<br \/>\n    }<br \/>\n}<\/p>\n<p>[\/crayon]<\/p>\n\n\n\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Java with Couchbase doesn&#8217;t have to be hard, even for a new developer. In this quickstart tutorial, we&#8217;re going to walk through the basics of creating and fetching JSON documents in Couchbase using the Java SDK. With minimalist code samples, you can be connecting and testing your application right away. Set Up a Basic [&hellip;]<\/p>\n","protected":false},"author":75185,"featured_media":1965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[136,178,54,144,64],"tags":[30,445,232,185,493,222],"ppma_author":[326],"class_list":["post-1966","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-connectors","category-couchbase-server","category-java","category-tools-sdks","tag-json","tag-key-value","tag-maven","tag-microsoft","tag-upsert","tag-visual-studio-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using Java SDK: The Basics of Get &amp; Upsert | Couchbase<\/title>\n<meta name=\"description\" content=\"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.\" \/>\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\/ko\/using-java-sdk-for-couchbase-basics-get-upsert\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert\" \/>\n<meta property=\"og:description\" content=\"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ko\/using-java-sdk-for-couchbase-basics-get-upsert\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-20T10:47:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\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: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=\"5\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/\"},\"author\":{\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/684cc0e5c60cd2e4b591db9621494ed0\"},\"headline\":\"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert\",\"datePublished\":\"2021-07-20T10:47:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/\"},\"wordCount\":1002,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-document-viewer.png\",\"keywords\":[\"JSON\",\"key value\",\"maven\",\"Microsoft\",\"upsert\",\"Visual Studio Code\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Connectors\",\"Couchbase Server\",\"Java\",\"Tools &amp; SDKs\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/\",\"name\":\"Using Java SDK: The Basics of Get & Upsert | Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-document-viewer.png\",\"datePublished\":\"2021-07-20T10:47:56+00:00\",\"description\":\"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-document-viewer.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-document-viewer.png\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/using-java-sdk-for-couchbase-basics-get-upsert\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert\"}]},{\"@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\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"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\":\"ko-KR\",\"@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\\\/ko\\\/author\\\/tylermitchell\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Java SDK: The Basics of Get & Upsert | Couchbase","description":"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.","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\/ko\/using-java-sdk-for-couchbase-basics-get-upsert\/","og_locale":"ko_KR","og_type":"article","og_title":"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert","og_description":"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.","og_url":"https:\/\/www.couchbase.com\/blog\/ko\/using-java-sdk-for-couchbase-basics-get-upsert\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-07-20T10:47:56+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png","type":"image\/png"}],"author":"Tyler Mitchell - Senior Product Marketing Manager","twitter_card":"summary_large_image","twitter_creator":"@1tylermitchell","twitter_misc":{"Written by":"Tyler Mitchell - Senior Product Marketing Manager","Est. reading time":"5\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/"},"author":{"name":"Tyler Mitchell - Senior Product Marketing Manager","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0"},"headline":"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert","datePublished":"2021-07-20T10:47:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/"},"wordCount":1002,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png","keywords":["JSON","key value","maven","Microsoft","upsert","Visual Studio Code"],"articleSection":["Best Practices and Tutorials","Connectors","Couchbase Server","Java","Tools &amp; SDKs"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/","url":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/","name":"Using Java SDK: The Basics of Get & Upsert | Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png","datePublished":"2021-07-20T10:47:56+00:00","description":"This post will walk you through the basics of creating and fetching JSON documents in Couchbase using the Java SDK with minimalist code samples.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-document-viewer.png","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/pt\/using-java-sdk-for-couchbase-basics-get-upsert\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using the Java SDK for Couchbase: The Basics of Get &amp; Upsert"}]},{"@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":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","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":"ko-KR","@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\/ko\/author\/tylermitchell\/"}]}},"acf":[],"authors":[{"term_id":326,"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\/ko\/wp-json\/wp\/v2\/posts\/1966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/users\/75185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/comments?post=1966"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/1966\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media\/1965"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media?parent=1966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/categories?post=1966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/tags?post=1966"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/ppma_author?post=1966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}