{"id":12222,"date":"2021-10-07T00:00:30","date_gmt":"2021-10-07T07:00:30","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=12222"},"modified":"2025-06-13T18:43:19","modified_gmt":"2025-06-14T01:43:19","slug":"couchbase-java-developer-walkthrough","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-java-developer-walkthrough\/","title":{"rendered":"Introducci\u00f3n a Couchbase + Java [Gu\u00eda para desarrolladores]"},"content":{"rendered":"<p><strong>Si eres un desarrollador que<\/strong> Si eres nuevo en Couchbase, este art\u00edculo te ayudar\u00e1 a empezar.<\/p>\n<p>Esta serie de tutoriales semanales le ayudar\u00e1 a comprender los conceptos b\u00e1sicos de la conexi\u00f3n a Couchbase, le mostrar\u00e1 c\u00f3mo recuperar y modificar datos en Couchbase Server, c\u00f3mo utilizar <a href=\"https:\/\/query-tutorial.couchbase.com\/tutorial\/?ref=blog\/#1\" target=\"_blank\" rel=\"noopener\">el lenguaje de consulta SQL<\/a> (antes conocido como N1QL) y m\u00e1s. Esta semana, el c\u00f3digo de ejemplo ser\u00e1 Java, y usaremos Couchbase Java SDK.<\/p>\n<p><a href=\"https:\/\/developer.couchbase.com\/new-to-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Couchbase<\/a> es un distribuido, <a href=\"https:\/\/www.couchbase.com\/blog\/es\/json-database\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Base de datos de documentos JSON<\/a>. Expone un almac\u00e9n de valores clave escalable con cach\u00e9 gestionada para operaciones de datos en submilisegundos, indexadores espec\u00edficos para consultas eficientes y un potente motor de consulta para ejecutar consultas de tipo SQL.<\/p>\n<p>In this developer walkthrough, we will look at the basic features of Couchbase \u2013 both through a non-relational JSON interface and relational SQL interface. Couchbase ships with a sample database, `travel-sample`, and we&#8217;ll use this sample dataset to learn Couchbase fundamentals using the Java SDK.<\/p>\n<h2>Comprender el conjunto de datos de muestras de viajes<\/h2>\n<p>In order to gain a better understanding of what the `travel-sample` dataset looks like, feel free to <a href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/ref\/travel-app-data-model.html?ref=blog\" target=\"_blank\" rel=\"noopener\">lea sobre ello en la documentaci\u00f3n del SDK de Java: Modelo de datos de la aplicaci\u00f3n de viajes<\/a>.<\/p>\n<p>Below is an entity-relationship diagram of the `travel-sample` dataset along with an accompanying data model:<\/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\/10\/travel-sample-entity-relationship-diagram-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12226\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/travel-sample-entity-relationship-diagram-couchbase.png\" alt=\"The Couchbase travel-sample dataset in an E-R diagram\" width=\"1000\" height=\"960\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/travel-sample-entity-relationship-diagram-couchbase.png 1000w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/travel-sample-entity-relationship-diagram-couchbase-300x288.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/travel-sample-entity-relationship-diagram-couchbase-768x737.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/travel-sample-entity-relationship-diagram-couchbase-20x20.png 20w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/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\/10\/json-document-data-model.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12225\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/json-document-data-model.png\" alt=\"A JSON document data model in Couchbase\" width=\"538\" height=\"490\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-data-model.png 538w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-data-model-300x273.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-data-model-20x18.png 20w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo utilizar la funci\u00f3n Get clave-valor para recuperar datos<\/h2>\n<p>Clave-valor (tambi\u00e9n conocido como Couchbase Data Service) ofrece la forma m\u00e1s sencilla de recuperar o mutar datos cuando se conoce la clave. Un almac\u00e9n de clave-valor es un tipo de <a href=\"https:\/\/www.couchbase.com\/blog\/es\/resources\/why-nosql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Base de datos NoSQL<\/a> que utiliza un m\u00e9todo sencillo para almacenar datos como una colecci\u00f3n de pares clave-valor en la que una clave sirve de identificador \u00fanico.<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/server\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Servidor Couchbase<\/a> is a key-value store that&#8217;s agnostic to what&#8217;s stored. The example below shows you how to use the key-value `get` function in order to retrieve data from a backend.<\/p>\n<p>Antes de continuar, aseg\u00farate de que est\u00e1s familiarizado con los conceptos b\u00e1sicos de autorizaci\u00f3n y conexi\u00f3n a un cl\u00faster Couchbase. <a href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/hello-world\/start-using-sdk.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Lea la secci\u00f3n \"Empezar a utilizar el SDK de Java\" de la documentaci\u00f3n de Couchbase.<\/a> si necesitas ponerte al d\u00eda.<\/p>\n<p>A continuaci\u00f3n se indican las tres importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.DocumentNotFoundException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.*;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctate al cluster que almacena los datos que quieres recuperar. Como est\u00e1s usando Java, primero aseg\u00farate de declarar una clase y un m\u00e9todo principal. A continuaci\u00f3n, crea una variable para tu cl\u00faster.<\/p>\n<p>In the example below, `cluster` is the name of the variable of type `var`. Using a connection string, have your program connect with the data in the backend. A Couchbase connection string is a comma-delimited list of IP addresses and\/or hostnames, optionally followed by a list of parameters. Below, `couchbase:\/\/127.0.0.1` is a simple connection string with one seed node followed by a username and password. Be sure to replace all this information with information relative to your program.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Una conexi\u00f3n a un cluster de Couchbase Server est\u00e1 representada por un objeto cluster. Un cl\u00faster proporciona acceso a los buckets, <a href=\"https:\/\/www.couchbase.com\/blog\/es\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/?ref=blog\" target=\"_blank\" rel=\"noopener\">\u00e1mbitos y colecciones<\/a>as\u00ed como diversos servicios e interfaces de gesti\u00f3n de Couchbase.<\/p>\n<p>Despu\u00e9s de proporcionar la cadena de conexi\u00f3n, el nombre de usuario y la contrase\u00f1a anteriores, est\u00e1s conectado a un cl\u00faster de Couchbase y ahora puedes conectarte a un bucket y una colecci\u00f3n de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n    var collection = bucket.defaultCollection();\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The Java `get` method allows you to retrieve a certain piece of data. Given a document&#8217;s key, you can use the `collection.get()` method to retrieve a document from a collection.<\/p>\n<p>In this example, you&#8217;re retrieving the content in the collection named `&#8221;airline_10&#8243;` in the database. Then, in order to see the result, there is a `print` statement which allows you to finish retrieving the data.<\/p>\n<pre>      try {\r\n        var result = collection.get(\"airline_10\");\r\n        System.out.println(result.toString());\r\n          }\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Lastly, just in case the user tries to retrieve a piece of information that does not exist or is not within the bounds of the document, there is a `catch` exception to make sure there are no errors in the code.<\/p>\n<pre>      catch (DocumentNotFoundException ex) {\r\n      System.out.println(\"Document not found!\");\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Utilizar el m\u00e9todo de consulta para recuperar datos<\/h2>\n<p>A query is always performed at the cluster level, specifically using the `query` method. This method takes the statement as a required argument and then allows it to provide additional options if needed.<\/p>\n<p>Once a result returns you can iterate the returned rows and\/or access the `QueryMetaData` associated with the query. If something goes wrong during the execution of the query, a derivative of the `CouchbaseException` is thrown that also provides additional context on the operation.<\/p>\n<p>A continuaci\u00f3n figuran las cinco importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.DocumentNotFoundException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.*;\r\nimport com.couchbase.client.java.json.JsonObject;\r\nimport com.couchbase.client.java.query.QueryResult;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>This is an example of performing a query and handling the results. The result that prints is `&#8221;Hotel: &#8220;` followed by the name, city, state and other information specific to the hotel. Only up to five rows will be printed since that is the number limit represented in the code. In order to test out different queries, try changing the name of the city in line six to any other city.<\/p>\n<pre> try {\r\n      var query = \r\n        \"SELECT h.name, h.city, h.state \" +\r\n        \"FROM `travel-sample` h \" +\r\n        \"WHERE h.type = 'hotel' \" +\r\n          \"AND h.city = 'Malibu' LIMIT 5;\";\r\n\r\n      QueryResult result = cluster.query(query);\r\n      for (JsonObject row : result.rowsAsObject()) {\r\n        System.out.println(\"Hotel: \" + row);\r\n      }\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As before, the `catch` exception ensures there are no errors in your code. For example, if you chose a city that your database doesn&#8217;t have, this `DocumentNotFoundException` exception will print `&#8221;Document not found!&#8221;`.<\/p>\n<pre>     } catch (DocumentNotFoundException ex) {\r\n      System.out.println(\"Document not found!\");\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo consultar con par\u00e1metros con nombre<\/h2>\n<p>Como se ha mencionado anteriormente, los m\u00e9todos de consulta permiten buscar informaci\u00f3n espec\u00edfica en una base de datos en funci\u00f3n de determinados criterios. Los m\u00e9todos de consulta pueden tener par\u00e1metros nominales o posicionales.<\/p>\n<p>En esta secci\u00f3n, repasaremos qu\u00e9 son los par\u00e1metros con nombre y c\u00f3mo resultan \u00fatiles cuando se invocan m\u00e9todos con un gran n\u00famero de par\u00e1metros. Los par\u00e1metros con nombre indican claramente el nombre del par\u00e1metro al invocar un m\u00e9todo. Permiten a los usuarios invocar el m\u00e9todo con un subconjunto aleatorio de ellos, utilizando valores por defecto para el resto de los par\u00e1metros.<\/p>\n<p>A continuaci\u00f3n figuran las siete importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.CouchbaseException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.*;\r\nimport com.couchbase.client.java.json.JsonObject;\r\nimport com.couchbase.client.java.query.QueryResult;\r\nimport com.couchbase.client.java.query.QueryOptions;\r\nimport static com.couchbase.client.java.query.QueryOptions.queryOptions;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The code proceeds to access the `travel-sample` database and specifically the name, city and state buckets. The `queryOptions()` method allows the customization of various SQL++ query options.<\/p>\n<p>In the code below, the result brings back data of types: `hotel` and `city: Malibu`. Since the limit is five, only up to five rows are printed. The result that&#8217;s printed is `&#8221;Hotel: &#8220;` followed by information including the name and city.<\/p>\n<pre>    try {\r\n      var query = \r\n        \"SELECT h.name, h.city, h.state \" +\r\n        \"FROM `travel-sample` h \" +\r\n        \"WHERE h.type = $type \" +\r\n          \"AND h.city = $city LIMIT 5;\";\r\n\r\n      QueryResult result = cluster.query(query,\r\n        queryOptions().parameters(\r\n          JsonObject.create()\r\n            .put(\"type\", \"hotel\")\r\n            .put(\"city\", \"Malibu\")\r\n        ));\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The result is taken from the `travel-sample` database, specifically from the rows. The `.stream` method is used to compute elements as per the primary method without changing the original value of the JSON object.<\/p>\n<pre>          result.rowsAsObject().stream().forEach(\r\n        e-&gt; System.out.println(\r\n          \"Hotel: \" + e.getString(\"name\") + \", \" + e.getString(\"city\"))\r\n      );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As before, the `catch` exception ensures there are no errors in your code. For example, if you chose a city or type of place that our database does not have, this `CouchbaseException` exception will print `&#8221;Exception: &#8220;` along with the string representation of the object that is causing the error.<\/p>\n<pre>    } catch (CouchbaseException ex) {\r\n      System.out.println(\"Exception: \" + ex.toString());\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo consultar con par\u00e1metros posicionales<\/h2>\n<p>Como se mencion\u00f3 anteriormente, los m\u00e9todos de consulta pueden tener par\u00e1metros de nombre o de posici\u00f3n. Ya hemos hablado de los par\u00e1metros con nombre.<\/p>\n<p>En esta secci\u00f3n, repasaremos los par\u00e1metros posicionales y su utilidad cuando se llaman m\u00e9todos con un gran n\u00famero de par\u00e1metros. Los par\u00e1metros posicionales permiten sustituir el orden de los par\u00e1metros del m\u00e9todo por marcadores de posici\u00f3n.<\/p>\n<p>Por ejemplo, el primer marcador de posici\u00f3n se sustituye por el primer par\u00e1metro del m\u00e9todo, el segundo marcador de posici\u00f3n se sustituye por el segundo par\u00e1metro del m\u00e9todo, etc.<\/p>\n<p>A continuaci\u00f3n figuran las siete importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.CouchbaseException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.*;\r\nimport com.couchbase.client.java.json.JsonArray;\r\nimport com.couchbase.client.java.query.QueryResult;\r\nimport com.couchbase.client.java.query.QueryOptions;\r\nimport static com.couchbase.client.java.query.QueryOptions.queryOptions;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The query below searches for the name, city and state from the `travel-sample` database taking into account specifically the type of place and the city. Later on, these are revealed as hotels in Malibu.<\/p>\n<pre>    try {\r\n      var query = \r\n        \"SELECT h.name, h.city, h.state \" +\r\n        \"FROM `travel-sample` h \" +\r\n        \"WHERE h.type = $1 \" +\r\n          \"AND h.city = $2 LIMIT 5;\";\r\n          \r\n      QueryResult result = cluster.query(query,\r\n        queryOptions().parameters(JsonArray.from(\"hotel\", \"Malibu\"))      );\r\n\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As with the named parameters example above, the `.stream` method is used to compute elements as per the primary method without changing the original value of the JSON object.<\/p>\n<pre>      result.rowsAsObject().stream().forEach(\r\n        e-&gt; System.out.println(\r\n          \"Hotel: \" + e.getString(\"name\") + \", \" + e.getString(\"city\"))\r\n      );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo utilizar las operaciones de b\u00fasqueda de subdocumentos<\/h2>\n<p><a href=\"https:\/\/docs.couchbase.com\/java-sdk\/2.7\/subdocument-operations.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Subdocumentos<\/a> son partes del documento JSON que puedes actualizar y recuperar de forma at\u00f3mica y eficiente.<\/p>\n<p>Mientras que las recuperaciones de documentos completos recuperan el documento completo y las actualizaciones de documentos completos requieren el env\u00edo del documento completo, las recuperaciones de subdocumentos s\u00f3lo recuperan las partes relevantes de un documento y las actualizaciones de subdocumentos s\u00f3lo requieren el env\u00edo de las partes actualizadas de un documento. Debes utilizar operaciones de subdocumento siempre que vayas a modificar s\u00f3lo partes de un documento, y operaciones de documento completo s\u00f3lo cuando el contenido de un documento vaya a cambiar significativamente.<\/p>\n<p>Las operaciones de subdocumento descritas en este art\u00edculo son para <strong>s\u00f3lo solicitudes clave-valor<\/strong>no est\u00e1n relacionadas con las consultas SQL++ de subdocumentos. Para utilizar las operaciones de subdocumento es necesario especificar una ruta que indique la ubicaci\u00f3n del subdocumento.<\/p>\n<p>The `lookupIn` operation queries the document for a certain path(s) and returns that path(s). You have a choice of actually retrieving the document path using the `<a href=\"https:\/\/www.couchbase.com\/blog\/es\/subdoc-explained\/\">subdoc<\/a> get` sub-document operation, or simply querying the existence of the path using the `subdoc exists` sub-document operation. The latter saves even more bandwidth by not retrieving the contents of the path if it is not needed.<\/p>\n<p>A continuaci\u00f3n figuran las cinco importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.DocumentNotFoundException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.LookupInResult;\r\nimport static com.couchbase.client.java.kv.LookupInSpec.get;\r\nimport java.util.Collections;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n    var collection = bucket.defaultCollection();\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>In the code below, the `lookupIn`operation queries the `airport_1254` document for a certain path, the `geo.alt` path. This code allows us to retrieve the document path using the `subdoc get` sub-document operation: `(get(&#8220;geo.alt&#8221;))`.<\/p>\n<pre>try {\r\n      LookupInResult result = collection.lookupIn(\r\n        \"airport_1254\",\r\n        Collections.singletonList(get(\"geo.alt\"))\r\n      );\r\n\r\n      var str = result.contentAs(0, String.class);\r\n      System.out.println(\"Altitude = \" + str);\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As before, the `catch` exception ensures there are no errors in your code. For example, if you chose a city that our database does not have, this `DocumentNotFoundException` exception will print `&#8221;Document not found!&#8221;`.<\/p>\n<pre>     } catch (DocumentNotFoundException ex) {\r\n      System.out.println(\"Document not found!\");\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo utilizar las operaciones de mutaci\u00f3n de subdocumentos<\/h2>\n<p>Las operaciones de mutaci\u00f3n de subdocumentos modifican una o varias rutas del documento.<\/p>\n<p>The simplest of these operations is `subdoc upsert`. Just like the fulldoc-level upsert, the `subdoc upsert` operation either modifies the value of an existing path or creates it if it doesn&#8217;t exist. Likewise, the `subdoc insert` operation only adds the new value to the path if it doesn&#8217;t exist.<\/p>\n<p>A continuaci\u00f3n figuran las ocho importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.subdoc.PathNotFoundException;\r\nimport com.couchbase.client.core.error.subdoc.PathExistsException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.LookupInResult;\r\nimport static com.couchbase.client.java.kv.LookupInSpec.get;\r\nimport static com.couchbase.client.java.kv.MutateInSpec.upsert;\r\nimport java.util.Collections;\r\nimport java.util.Arrays;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n    var collection = bucket.defaultCollection();\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>In the code below, the `mutateIn` operation is used to modify the `&#8221;airline_10&#8243;` by using a fulldoc-level upsert which will create the value of an existing path with parameters `(&#8220;country&#8221;, &#8220;Canada&#8221;)`.<\/p>\n<pre>    try {\r\n      LookupInResult result = collection.lookupIn(\r\n        \"airline_10\", Collections.singletonList(get(\"country\"))\r\n      );\r\n\r\n      var str = result.contentAs(0, String.class);\r\n      System.out.println(\"Sub-doc before: \");\r\n      System.out.println(str);\r\n      \r\n    } catch (PathNotFoundException e) {\r\n      System.out.println(\"Sub-doc path not found!\");\r\n    }\r\n\r\n    try {\r\n      collection.mutateIn(\"airline_10\", Arrays.asList(\r\n        upsert(\"country\", \"Canada\")\r\n      ));\r\n    } catch (PathExistsException e) {\r\n      System.out.println(\"Sub-doc path exists!\");\r\n    }\r\n\r\n    try {\r\n      LookupInResult result = collection.lookupIn(\r\n        \"airline_10\", Collections.singletonList(get(\"country\"))\r\n      );\r\n\r\n      var str = result.contentAs(0, String.class);\r\n      System.out.println(\"Sub-doc after: \");\r\n      System.out.println(str);\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As before, the `catch` exception ensures there are no errors in your code. For example, if you chose a document that your local computer does not have the pathway to, this `PathNotFoundException` exception will print `&#8221;Sub-doc path not found!&#8221;`.<\/p>\n<pre>    } catch (PathNotFoundException e) {\r\n      System.out.println(\"Sub-doc path not found!\");\r\n    }\r\n    \r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo utilizar la funci\u00f3n Upsert<\/h2>\n<p><a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/upsert.html?ref=blog\" target=\"_blank\" rel=\"noopener\">La funci\u00f3n Upsert<\/a> is used to insert a new record or update an existing one. If the document doesn&#8217;t exist it will be created. Upsert is a combination of `insert` and `update`.<\/p>\n<p>Users executing the `upsert` statement must have the Query Update and Query Insert privileges on the target keyspace. If the statement has any returning clauses, then the Query Select privilege is also required on the keyspaces referred in the respective clauses. For more details about user roles, <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/security\/authorization-overview.html?ref=blog\" target=\"_blank\" rel=\"noopener\">consulte la documentaci\u00f3n de Autorizaci\u00f3n sobre el control de acceso basado en roles (RBAC) en Couchbase<\/a>.<\/p>\n<p>A continuaci\u00f3n se muestra un diagrama de la sintaxis b\u00e1sica para todas las operaciones upsert:<\/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\/10\/upsert-basic-syntax-couchbase-database.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12227\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/upsert-basic-syntax-couchbase-database.png\" alt=\"The basic syntax of an upsert function for the Couchbase database\" width=\"675\" height=\"81\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/upsert-basic-syntax-couchbase-database.png 675w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/upsert-basic-syntax-couchbase-database-300x36.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/upsert-basic-syntax-couchbase-database-20x2.png 20w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n figuran las nueve importaciones que necesita:<\/p>\n<pre>import com.couchbase.client.core.error.subdoc.PathNotFoundException;\r\nimport com.couchbase.client.java.*;\r\nimport com.couchbase.client.java.kv.*;\r\nimport com.couchbase.client.java.kv.MutationResult;\r\nimport com.couchbase.client.java.json.JsonObject;\r\nimport com.couchbase.client.java.kv.LookupInResult;\r\nimport static com.couchbase.client.java.kv.LookupInSpec.get;\r\nimport static com.couchbase.client.java.kv.MutateInSpec.upsert;\r\nimport java.util.Collections;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>A continuaci\u00f3n, con\u00e9ctese al cl\u00faster que almacena los datos que desea recuperar, siguiendo pasos similares a los anteriores. Aseg\u00farate de sustituir toda esta informaci\u00f3n por la relativa a tu programa.<\/p>\n<pre>class Program {\r\n    public static void main(String[] args) {\r\n    var cluster = Cluster.connect(\r\n      \"couchbase:\/\/127.0.0.1\", \"username\", \"password\"\r\n    );\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como antes, est\u00e1s conectado a un cluster de Couchbase y ahora puedes conectarte a un bucket de Couchbase:<\/p>\n<pre>    var bucket = cluster.bucket(\"travel-sample\");\r\n    var collection = bucket.defaultCollection();\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The `.put` method allows for the user to insert a mapping into a map. This means you can insert a specific key (and the value it is mapping to) into a particular map. If an existing key is passed then the previous value gets replaced by the new value.<\/p>\n<pre>    JsonObject content = JsonObject.create()\r\n      .put(\"country\", \"Iceland\")\r\n      .put(\"callsign\", \"ICEAIR\")\r\n      .put(\"iata\", \"FI\")\r\n      .put(\"icao\", \"ICE\")\r\n      .put(\"id\", 123)\r\n      .put(\"name\", \"Icelandair\")\r\n      .put(\"type\", \"airline\");\r\n\r\n    collection.upsert(\"airline_123\", content);\r\n      \r\n    try {\r\n      LookupInResult lookupResult = collection.lookupIn(\r\n        \"airline_123\", Collections.singletonList(get(\"name\"))\r\n      );\r\n\r\n      var str = lookupResult.contentAs(0, String.class);\r\n      System.out.println(\"New Document name = \" + str);\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>As before, the `catch` exception ensures there are no errors in your code. For example, if you chose a document that your local computer does not have the pathway to, this `PathNotFoundException` exception will print `&#8221;Document not found!&#8221;`.<\/p>\n<pre>    } catch (PathNotFoundException ex) {\r\n      System.out.println(\"Document not found!\");\r\n    }\r\n    \r\n  }\r\n}\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Conclusi\u00f3n<\/h2>\n<p>Espero que este tutorial introductorio te haya ayudado a entender - y ejecutar - algunas de las funciones m\u00e1s comunes cuando se trabaja con Couchbase y el SDK de Java. Para sumergirte en pasos intermedios y avanzados, <a href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/hello-world\/start-using-sdk.html?ref=blog\" target=\"_blank\" rel=\"noopener\">consulte la documentaci\u00f3n del SDK de Java aqu\u00ed<\/a>.<\/p>\n<p>Si necesitas ayuda o necesitas algo de inspiraci\u00f3n, <a href=\"https:\/\/www.couchbase.com\/blog\/es\/forums\/?ref=blog\" target=\"_blank\" rel=\"noopener\">consulte los foros de Couchbase<\/a> y conectar con desarrolladores afines de la comunidad.<\/p>\n<p>Como siguiente paso, te animo a que consultes la gu\u00eda gratuita en l\u00ednea <a href=\"https:\/\/learn.couchbase.com\/store\/1288710-cb130j-couchbase-associate-java-developer-certification-course-v7?ref=blog\" target=\"_blank\" rel=\"noopener\">Curso de certificaci\u00f3n Couchbase Associate Java Developer<\/a> ofrecido por <a href=\"https:\/\/www.couchbase.com\/blog\/es\/academy\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Academia Couchbase<\/a>.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 30px\" aria-hidden=\"true\"><\/div>\n<div style=\"text-align: center\"><strong>No te limites a leer sobre ello, <em>construya<\/em> algo:<br \/><a href=\"https:\/\/www.couchbase.com\/blog\/es\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Empiece a utilizar Couchbase 7 hoy mismo<\/a><\/strong><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re a developer who&#8217;s new to Couchbase, this article helps you get started. This weekly walkthrough series helps you understand the basics of connecting to Couchbase, shows you how to retrieve and modify data in Couchbase Server, how to [&hellip;]<\/p>","protected":false},"author":79065,"featured_media":12224,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,2381,2242,1816,1819,1818,9336,1813,1812,2201],"tags":[2312,1261,2313,1725,1903,1962,9317],"ppma_author":[9463],"class_list":["post-12222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-community","category-connectors","category-couchbase-server","category-data-modeling","category-java","category-scopes-and-collections","category-security","category-n1ql-query","category-tools-sdks","tag-document-database","tag-json","tag-key-value","tag-nosql-database","tag-rbac","tag-role-based-access-control","tag-upsert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Couchbase + Java Developer Walkthrough \u2013 Get Started!<\/title>\n<meta name=\"description\" content=\"In this developer walkthrough, we will look at the basic features of Couchbase \u2013 both through a non-relational JSON interface and relational SQL interface.\" \/>\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\/es\/couchbase-java-developer-walkthrough\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Started with Couchbase + Java [Developer Walkthrough]\" \/>\n<meta property=\"og:description\" content=\"In this developer walkthrough, we will look at the basic features of Couchbase \u2013 both through a non-relational JSON interface and relational SQL interface.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/couchbase-java-developer-walkthrough\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-07T07:00:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T01:43:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough-social.jpg\" \/>\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\/jpeg\" \/>\n<meta name=\"author\" content=\"Nirupama Suravarjjala\" \/>\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\/10\/get-started-couchbase-java-sdk-developer-walkthrough-social.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nirupama Suravarjjala\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/\"},\"author\":{\"name\":\"Nirupama Suravarjjala\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bec70d9099ea0ff021938d01aeb5a033\"},\"headline\":\"Get Started with Couchbase + Java [Developer Walkthrough]\",\"datePublished\":\"2021-10-07T07:00:30+00:00\",\"dateModified\":\"2025-06-14T01:43:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/\"},\"wordCount\":2231,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg\",\"keywords\":[\"document database\",\"JSON\",\"key value\",\"NoSQL Database\",\"RBAC\",\"Role Based Access Control (RBAC)\",\"upsert\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Community\",\"Connectors\",\"Couchbase Server\",\"Data Modeling\",\"Java\",\"Scopes and Collections\",\"Security\",\"SQL++ \/ N1QL Query\",\"Tools &amp; SDKs\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/\",\"name\":\"Couchbase + Java Developer Walkthrough \u2013 Get Started!\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg\",\"datePublished\":\"2021-10-07T07:00:30+00:00\",\"dateModified\":\"2025-06-14T01:43:19+00:00\",\"description\":\"In this developer walkthrough, we will look at the basic features of Couchbase \u2013 both through a non-relational JSON interface and relational SQL interface.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg\",\"width\":1200,\"height\":628,\"caption\":\"Learn the basics of using Couchbase in this new developer tutorial using Java SDK code examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Started with Couchbase + Java [Developer Walkthrough]\"}]},{\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\/bec70d9099ea0ff021938d01aeb5a033\",\"name\":\"Nirupama Suravarjjala\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/e69bb35c1c3b5c0146633903aec65476\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg\",\"caption\":\"Nirupama Suravarjjala\"},\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/nirupama-suravarjjala\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Couchbase + Java Developer Walkthrough \u2013 Get Started!","description":"En este tutorial para desarrolladores, veremos las caracter\u00edsticas b\u00e1sicas de Couchbase, tanto a trav\u00e9s de una interfaz JSON no relacional como de una interfaz SQL relacional.","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\/es\/couchbase-java-developer-walkthrough\/","og_locale":"es_MX","og_type":"article","og_title":"Get Started with Couchbase + Java [Developer Walkthrough]","og_description":"In this developer walkthrough, we will look at the basic features of Couchbase \u2013 both through a non-relational JSON interface and relational SQL interface.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-java-developer-walkthrough\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-10-07T07:00:30+00:00","article_modified_time":"2025-06-14T01:43:19+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough-social.jpg","type":"image\/jpeg"}],"author":"Nirupama Suravarjjala","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough-social.jpg","twitter_misc":{"Written by":"Nirupama Suravarjjala","Est. reading time":"11 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/"},"author":{"name":"Nirupama Suravarjjala","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bec70d9099ea0ff021938d01aeb5a033"},"headline":"Get Started with Couchbase + Java [Developer Walkthrough]","datePublished":"2021-10-07T07:00:30+00:00","dateModified":"2025-06-14T01:43:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/"},"wordCount":2231,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg","keywords":["document database","JSON","key value","NoSQL Database","RBAC","Role Based Access Control (RBAC)","upsert"],"articleSection":["Best Practices and Tutorials","Community","Connectors","Couchbase Server","Data Modeling","Java","Scopes and Collections","Security","SQL++ \/ N1QL Query","Tools &amp; SDKs"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/","name":"Couchbase + Java Developer Walkthrough \u2013 Get Started!","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg","datePublished":"2021-10-07T07:00:30+00:00","dateModified":"2025-06-14T01:43:19+00:00","description":"En este tutorial para desarrolladores, veremos las caracter\u00edsticas b\u00e1sicas de Couchbase, tanto a trav\u00e9s de una interfaz JSON no relacional como de una interfaz SQL relacional.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/get-started-couchbase-java-sdk-developer-walkthrough.jpg","width":1200,"height":628,"caption":"Learn the basics of using Couchbase in this new developer tutorial using Java SDK code examples"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-java-developer-walkthrough\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Get Started with Couchbase + Java [Developer Walkthrough]"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","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":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@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\/bec70d9099ea0ff021938d01aeb5a033","name":"Nirupama Suravarjjala","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/e69bb35c1c3b5c0146633903aec65476","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg","caption":"Nirupama Suravarjjala"},"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/nirupama-suravarjjala\/"}]}},"authors":[{"term_id":9463,"user_id":79065,"is_guest":0,"slug":"nirupama-suravarjjala","display_name":"Nirupama Suravarjjala","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/nirupama-suravarjjala-couchbase-intern.jpeg"},"author_category":"","last_name":"Suravarjjala","first_name":"Nirupama","job_title":"","user_url":"","description":"Nirupama Suravarjjala served as an intern on the Couchbase Developer Advocacy team."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/12222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/79065"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=12222"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/12222\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/12224"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=12222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=12222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=12222"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=12222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}