{"id":9756,"date":"2021-08-16T00:00:46","date_gmt":"2021-08-16T07:00:46","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=9756"},"modified":"2025-06-13T18:43:32","modified_gmt":"2025-06-14T01:43:32","slug":"simplifying-query-index-with-collections","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/simplifying-query-index-with-collections\/","title":{"rendered":"5 pasos para agilizar sus consultas N1QL y migrar a Collections"},"content":{"rendered":"<p><strong>Si desea migrar sus datos de una base de datos relacional a NoSQL,<\/strong> entonces ahora es mejor momento que nunca.<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/es\/couchbase-server-7-0-release\/?ref=blog\" target=\"_blank\" rel=\"noopener\">El reciente lanzamiento de Couchbase 7.0<\/a> introdujo \u00c1mbitos y Colecciones - una nueva forma de organizar su <a href=\"https:\/\/www.couchbase.com\/blog\/es\/json-database\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Datos JSON<\/a>. M\u00e1s que cualquier otra cosa, Scopes y Collections simplifican y facilitan la migraci\u00f3n de tu actual modelo de datos relacional al modelo de datos de documentos de Couchbase. Como resultado, tu empresa se beneficia de la arquitectura distribuida \"shared-nothing\", la alta disponibilidad y la escalabilidad horizontal de Couchbase.<\/p>\n<p>Y si eres cliente o usuario de Couchbase desde hace tiempo... <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\">Los \u00e1mbitos y las colecciones tienen mucho que ofrecer en t\u00e9rminos de gesti\u00f3n y organizaci\u00f3n de datos<\/a>.<\/p>\n<p>Pero tanto si eres nuevo en NoSQL como si eres un veterano de Couchbase, tus consultas a bases de datos - <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/n1ql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">utilizando el lenguaje de consulta N1QL<\/a> - beneficiarse del nuevo modelo de datos Scopes y Collections. Si quieres simplificar tus consultas N1QL, tendr\u00e1s que migrar tus datos de Couchbase del antiguo modelo Bucket al nuevo modelo Collections. Afortunadamente, la migraci\u00f3n es un proceso sencillo de cinco pasos.<\/p>\n<p>Empecemos con un repaso de \u00c1mbitos y Colecciones. (<a href=\"#data-migration\">O pase directamente a la gu\u00eda de migraci\u00f3n si est\u00e1 preparado<\/a>.)<\/p>\n<h2>Espera, \u00bfqu\u00e9 son los \u00e1mbitos y las colecciones?<\/h2>\n<p>Un Scope es equivalente a un esquema en una base de datos relacional (RDBMS). Es un contenedor l\u00f3gico para las colecciones de Couchbase. Cada Couchbase Bucket contiene un Scope por defecto. Puedes usar estos contenedores por defecto directamente - o definir los tuyos propios.<\/p>\n<p>Una Colecci\u00f3n es an\u00e1loga a una tabla en un RDBMS. Cada \u00e1mbito tiene una colecci\u00f3n por defecto. Mientras que una colecci\u00f3n <em>puede<\/em> utilizarse para almacenar tipos similares de registros (como una tabla RDBMS), <strong>no hay restricciones de esquema sobre lo que se puede almacenar en una colecci\u00f3n<\/strong>. Todo depende de ti.<\/p>\n<p>A continuaci\u00f3n se ilustra c\u00f3mo varios conceptos de bases de datos relacionales se corresponden con estas nuevas caracter\u00edsticas de <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/server\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Servidor Couchbase<\/a> 7.0:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9760\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM.png\" alt=\"\" width=\"787\" height=\"176\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM.png 2154w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-300x67.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-1024x229.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-768x172.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-1536x344.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-2048x458.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-20x4.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.33.49-PM-1320x295.png 1320w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Como puede ver, ahora hay un mapeo uno a uno entre los sistemas relacional y <a href=\"https:\/\/www.couchbase.com\/blog\/es\/resources\/why-nosql\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Modelos de datos NoSQL<\/a> al utilizar \u00e1mbitos y colecciones en <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/capella\/\" target=\"_blank\" rel=\"noopener\">Couchbase<\/a>.<\/p>\n<h3>Espacios de claves del sistema en \u00c1mbitos y colecciones<\/h3>\n<table>\n<tbody>\n<tr>\n<td><strong>Espacio clave<\/strong><\/td>\n<td><strong>Descripci\u00f3n<\/strong><\/td>\n<\/tr>\n<tr>\n<td>`system:all_scopes`<\/td>\n<td>Una lista de todos los \u00e1mbitos, incluidos los objetos del sistema, como los \u00e1mbitos por defecto<\/td>\n<\/tr>\n<tr>\n<td>`system:scopes`<\/td>\n<td>Todos los \u00e1mbitos disponibles excepto los \u00e1mbitos del sistema<\/td>\n<\/tr>\n<tr>\n<td>`system:all_collections`<\/td>\n<td>Una lista de todas las Colecciones, incluidos los objetos del sistema, como las Colecciones por defecto<\/td>\n<\/tr>\n<tr>\n<td>`system:collections`<\/td>\n<td>Todas las colecciones disponibles excepto las del sistema<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>C\u00f3mo los \u00e1mbitos y las colecciones agilizan sus consultas N1QL<\/h2>\n<p>One major consequence of Scopes and Collections is that the N1QL query language is now simpler. This is because a `type` field is no longer required on every document. As a result, both the Data Definition Language (DDL) and Data Manipulation Language (DML) of N1QL statements are easier to write and understand.<\/p>\n<h3>Las consultas N1QL son ahora m\u00e1s sencillas e intuitivas<\/h3>\n<p>Couchbase Collections te proporciona el equivalente de una tabla relacional. La fuerza de esta similitud -sin ninguna de sus debilidades- tiende un puente entre el mundo l\u00f3gico y el relacional. <a href=\"https:\/\/www.couchbase.com\/blog\/es\/conceptual-physical-logical-data-models\/\">modelo f\u00edsico de datos<\/a> al que est\u00e1n acostumbrados muchos RDBMS.<\/p>\n<p>Take a look at these side-by-side N1QL queries below using the `travel-sample` dataset.<\/p>\n<table style=\"height: 227px\" width=\"1264\">\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de recogida<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">SELECT  a.name\r\n  FROM `travel-sample` a  \r\nWHERE a.type='airport'\r\n   AND a.city='London'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">SELECT a.name \r\n FROM  airport a\r\nWHERE a.city='London'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The query on the left jumps illustrates how you had to specify the document `type` field under the old Bucket model. The query on the right is simpler because the document `type` is no longer required under the new Collection model introduced in Couchbase 7.0.<\/p>\n<h3>Las condiciones JOIN de N1QL tambi\u00e9n son m\u00e1s sencillas<\/h3>\n<p>Los JOINs en N1QL tambi\u00e9n se han vuelto m\u00e1s f\u00e1ciles. Eche un vistazo a esta comparaci\u00f3n de consultas antiguas y nuevas a continuaci\u00f3n.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de recogida<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">SELECT h.name, \r\n       a.faa\r\n FROM `travel-sample` h\r\n   JOIN `travel-sample` a  \r\n      ON h.city=a.city AND a.type='airport'\r\n WHERE h.type='hotel'\r\n   AND a.city='London'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">SELECT h.name, \r\n       a.faa\r\n FROM hotel h\r\n   JOIN airport a \r\n     ON h.city=a.city\r\n WHERE a.city='London'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Under the new Collection model, the JOIN syntax doesn&#8217;t require you to use the `type` field to restrict your query to a specific table of documents within the Bucket.<\/p>\n<h3>Las consultas N1QL mantienen la retrocompatibilidad con el modelo de cubo<\/h3>\n<p>La introducci\u00f3n del nuevo modelo Collection no significa el fin de Buckets. El Servicio de Consultas N1QL sigue soportando el modelo Bucket como hasta ahora.<\/p>\n<p>El \u00fanico cambio es que ahora sus datos de Bucket se almacenan en el Scope por defecto que a su vez contiene una Collection por defecto.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de recogida<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">SELECT a.faa \r\n FROM `travel-sample` a\r\nWHERE a.type='airport'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>Puedes usar:<\/p>\n<pre class=\"lang:default decode:true\">SELECT a.faa\r\nFROM `travel-sample`\r\nWHERE a.type='airport'\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><em>o<\/em><\/p>\n<pre class=\"lang:default decode:true\">SELECT a.faa\r\nFROM default:`travel-sample`._default._default a\r\nWHERE a.type='airport'\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Tenga en cuenta que <strong>el prefijo del espacio de nombres es obligatorio<\/strong> and should have the value `default:` for all references to the default Scope or default Collection.<\/p>\n<h2>Un cambio importante en las consultas N1QL con colecciones<\/h2>\n<p>Con el modelo Collection, <strong>el motor de consulta debe conocer la ruta completa del nombre de la colecci\u00f3n<\/strong>. Esto se debe a que el nombre de una colecci\u00f3n no tiene que ser \u00fanico dentro de un cubo, sino s\u00f3lo dentro de su propio \u00e1mbito.<\/p>\n<p>Un nombre de colecci\u00f3n completo tiene el siguiente formato:<\/p>\n<p>Formato:<\/p>\n<pre class=\"lang:default decode:true\">namespace:bucket.scope.collection<\/pre>\n<p>Por ejemplo:<\/p>\n<pre class=\"lang:default decode:true\">namespace:`travel-sample`.booking.hotel<\/pre>\n<p>However, you can reference a Collection with its relative path by setting the `query_context`<\/p>\n<p>En <strong>Interfaz del Query Workbench<\/strong> permite establecer el contexto de la consulta seleccionando el Cubo y el \u00c1mbito en el cuadro desplegable (en la parte superior derecha de la captura de pantalla siguiente).<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9759\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM.png\" alt=\"\" width=\"947\" height=\"140\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM.png 2314w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-300x44.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-1024x151.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-768x114.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-1536x227.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-2048x303.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-20x3.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/Screen-Shot-2020-11-13-at-12.29.32-PM-1320x195.png 1320w\" sizes=\"auto, (max-width: 947px) 100vw, 947px\" \/><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>El contexto de consulta tambi\u00e9n se admite en <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/developer-sdk\/?ref=blog\" target=\"_blank\" rel=\"noopener\">SDK de Couchbase<\/a>, <a href=\"https:\/\/docs.couchbase.com\/server\/current\/rest-api\/rest-intro.html?ref=blog\" target=\"_blank\" rel=\"noopener\">la API REST<\/a> y <a href=\"https:\/\/docs.couchbase.com\/server\/current\/tools\/cbq-shell.html?ref=blog\" target=\"_blank\" rel=\"noopener\">concha cbq<\/a>.<\/p>\n<h2>\u00bfTengo que migrar a Colecciones?<\/h2>\n<p>No, no tienes que migrar al modelo de Colecciones si no quieres.<\/p>\n<p>Esto es lo que no cambia si decide no migrar:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><strong>Datos:<\/strong> Todos los datos existentes permanecen en el mismo Bucket. Puede hacer referencia a sus documentos mediante la sintaxis de consulta de Bucket o utilizando el nuevo \u00c1mbito y Colecci\u00f3n predeterminados.<\/li>\n<li><strong>Consultas:<\/strong> La sintaxis de consulta N1QL para el DDL y el DML sigue soportando el modelo Bucket.<\/li>\n<li><strong>\u00cdndices:<\/strong> Sus \u00edndices existentes permanecer\u00e1n en el nivel Bucket y seguir\u00e1n estando disponibles para todas sus consultas como antes.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"data-migration\">Migraci\u00f3n de Bucket a Collections en Couchbase 7.0<\/h2>\n<p>Si est\u00e1s listo para migrar del antiguo modelo Bucket al nuevo modelo Scopes and Collections ahora disponible en Couchbase 7.0, aqu\u00ed est\u00e1n los cinco pasos principales que necesitas completar.<\/p>\n<p>For this migration guide, I&#8217;ll use the `travel-sample` Bucket as an example dataset.<\/p>\n<h3>Paso 1: Migraci\u00f3n de datos<\/h3>\n<p>Si sus documentos ya tienen un campo para identificar sus grupos, utilice esas agrupaciones para crear sus Colecciones.<\/p>\n<p>For the `travel-sample` dataset, let&#8217;s use the respective `type` fields as the Collection names. In addition, we&#8217;ll also create an `inventory` Scope for all of the Collections in the dataset.<\/p>\n<pre class=\"lang:default decode:true\">CREATE SCOPE `travel-sample`.inventory;\r\n \r\nCREATE COLLECTION `travel-sample`.inventory.route;\r\n\r\nCREATE COLLECTION `travel-sample.inventory.landmark;\r\n\r\nCREATE COLLECTION `travel-sample`.inventory.airline;\r\n\r\nCREATE COLLECTION `travel-sample`.inventory.hotel;\r\n\r\nCREATE COLLECTION `travel-sample`.inventory.airport;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>In the above example, we created an `inventory` Scope and added new Collections within the same `travel-sample` Bucket.<\/p>\n<h3>Paso 2: Garantizar claves de documento \u00fanicas<\/h3>\n<p>Las claves de los documentos deben ser \u00fanicas.<\/p>\n<p>La clave de documento que tiene actualmente para su(s) Bucket(s) existente(s) ya deber\u00eda ser \u00fanica porque todos sus documentos existen dentro del mismo Bucket. Por ese motivo, la clave de documento existente deber\u00eda ser adecuada para utilizarla como clave de documento de la nueva colecci\u00f3n.<\/p>\n<h3>Paso 3: Copie sus datos<\/h3>\n<p>In the below code sample, we&#8217;ll use `INSERT SELECT` to copy the data from the Bucket into each individual Collection. We also use the existing `META().id` Bucket key for the Collection key.<\/p>\n<pre class=\"lang:default decode:true\">INSERT INTO `travel-sample`.inventory.landmark (KEY k, VALUE val)\r\n SELECT META().id k, t val FROM `travel-sample` t WHERE t.type='landmark' ;\r\n\r\nINSERT INTO `travel-sample`.inventory.airline (KEY k, VALUE val)\r\n SELECT META().id k, t val FROM `travel-sample` t WHERE t.type='airline' ;\r\n\r\nINSERT INTO `travel-sample`.inventory.hotel (KEY k, VALUE val)\r\n ELECT META().id k, t val FROM `travel-sample` t WHERE t.type='hotel' ;\r\n\r\nINSERT INTO `travel-sample`.inventory.airport (KEY k, VALUE val)&amp;nbsp;\r\n SELECT META().id k, t val FROM `travel-sample` t WHERE t.type='airport' ;\r\n\r\nINSERT INTO `travel-sample`.inventory.route (KEY k, VALUE val)&amp;nbsp;\r\n SELECT META().id k, t val FROM `travel-sample` t WHERE t.type='route' ;\r\n<\/pre>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h3>Paso 4: Conversi\u00f3n de \u00edndices<\/h3>\n<p>Es muy probable que tenga que modificar sus \u00edndices de cubo existentes para que sean efectivos con el nuevo modelo de colecci\u00f3n.<\/p>\n<p>En las tres subsecciones siguientes se enumeran los patrones m\u00e1s comunes para los \u00edndices de cubos y se muestran los pasos para convertirlos en un \u00edndice basado en colecciones.<\/p>\n<h4>Conversi\u00f3n de \u00edndices: \u00cdndice de cubos con un predicado de tipo<\/h4>\n<p>For a Bucket index with a specific `type` field filter (i.e., a partial index), you can simply re-create the new index on the specific Collection for the type.<\/p>\n<p>Compare los dos ejemplos siguientes:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de colecci\u00f3n<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_route_src_dst_day` \r\nON `travel-sample`(\r\n      `sourceairport`,\r\n      `destinationairport`,\r\n       (distinct (array (`v`.`day`) \r\n         for `v` in `schedule` end))) \r\nWHERE (`type` = \"route\")\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_route_src_dst_day` \r\nON `travel-sample`.inventory.route(\r\n      `sourceairport`,\r\n      `destinationairport`,\r\n       (distinct (array (`v`.`day`) \r\n         for `v` in `schedule` end)))\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h4>Conversi\u00f3n de \u00edndices: \u00cdndice de cubos sin predicado de tipo<\/h4>\n<p>Puede crear un \u00edndice secundario global (GSI) para campos que pueden existir o no en el documento.<\/p>\n<p>For instance, an index may include the `icao` field, but not every document may have the `icao` field. For such an index, the indexer only includes the documents that have the `icao` field in them. If you&#8217;re using this kind of index, you may need to be more specific and create an index for the Collection where that field is being used.<\/p>\n<p>De nuevo, contraste los dos ejemplos de c\u00f3digo siguientes entre los modelos antiguo y nuevo:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de colecci\u00f3n<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_icao` ON `travel-sample`(`icao`)\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_icao` \r\nON `travel-sample`.inventory.airport(`icao`)\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h4>Conversi\u00f3n de \u00edndices: \u00cdndice de cubeta para un campo com\u00fan<\/h4>\n<p>Tambi\u00e9n puede crear un \u00edndice Bucket sin especificar el tipo concreto, aunque el campo exista en varios tipos de documento.<\/p>\n<p>Consider the example where the field `city` exists in multiple document types \u2013 e.g., airport, landmark and hotel documents. The Bucket model only has a single `def_city` index, which can cover all three document types. However, under the new Collection model, you&#8217;ll need to create a separate index for each Collection for this type of index.<\/p>\n<p>Puede ver las diferencias en los siguientes ejemplos de c\u00f3digo:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de colecci\u00f3n<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_city` ON `travel-sample`(`city`)\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">CREATE INDEX `def_airport_city` \r\nON `travel-sample`.inventory.airport(`city`);\r\n\r\nCREATE INDEX `def_hotel_city` \r\nON `travel-sample`.inventory.hotel(`city`);\r\n\r\nCREATE INDEX `def_landmark_city` \r\nON `travel-sample`.inventory.landmark(`city`);\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h3>Paso 5: Conversi\u00f3n de consultas<\/h3>\n<p>Debido a que el modelo de datos subyacente ha cambiado de un Cubo compartido a una Colecci\u00f3n individual, tendr\u00e1 que modificar sus consultas N1QL existentes.<\/p>\n<p>Adem\u00e1s, una vez modificadas las consultas, es necesario volver a comprobar que dichas consultas utilizan los nuevos \u00edndices basados en colecciones.<\/p>\n<p>Puede ver las consultas antiguas y actualizadas en los ejemplos de c\u00f3digo que figuran a continuaci\u00f3n:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Modelo de cubo<\/strong><\/td>\n<td><strong>Modelo de colecci\u00f3n<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"lang:default decode:true\">SELECT airline.name, \r\n       airport.airportname, \r\n       COUNT(1)\r\nFROM `travel-sample` airport\r\nINNER JOIN `travel-sample` route \r\n  ON airport.faa = route.sourceairport\r\n  AND route.type = \"route\"\r\nINNER JOIN `travel-sample` airline \r\n  ON route.airline = airline.iata\r\n  AND airline.type = \"airline\"\r\nWHERE airport.type = \"airport\"\r\n  AND airport.city = \"San Jose\"\r\n  AND airport.country = \"United States\"\r\n  AND ANY x in route.schedule \r\n            SATISFIES x.day =0 END\r\nGROUP BY airline.name, airport.airportname\r\n<\/pre>\n<p>&nbsp;<\/td>\n<td>\n<pre class=\"lang:default decode:true\">SELECT airline.name, \r\n       airport.airportname,\r\n       COUNT(1)\r\nFROM <del>`viaje-muestra<\/del> airport\r\nINNER JOIN <del>`viaje-muestra<\/del> route \r\n  ON airport.faa = route.sourceairport\r\n  <del>AND route.type = \"ruta\"<\/del>\r\nINNER JOIN <del>`viaje-muestra<\/del> airline \r\n  ON route.airline = airline.iata\r\n  <del>AND airline.type = \"airline\"<\/del>\r\nDONDE <del>airport.type = \"airport\"\r\n  AND<\/del> airport.city = \"San Jose\"\r\n  AND airport.country = \"United States\"\r\n  AND ANY x in route.schedule \r\n          SATISFIES x.day =0 END\r\nGROUP BY airline.name, airport.airportname\r\n<\/pre>\n<p>La consulta reescrita sin los filtros de tipo:<\/p>\n<pre class=\"lang:default decode:true\">SELECT airline.name, \r\n       airport.airportname, \r\n       COUNT(1)\r\nFROM airport\r\nINNER JOIN `travel-sample` route \r\n  ON airport.faa = route.sourceairport\r\nINNER JOIN `travel-sample` airline \r\n  ON route.airline = airline.iata\r\nWHERE airport.city = \"San Jose\"\r\n  AND airport.country = \"United States\"\r\n  AND ANY x in route.schedule \r\n            SATISFIES x.day =0 END\r\nGROUP BY airline.name, airport.airportname\r\n<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>Conclusi\u00f3n<\/h2>\n<p>Ya est\u00e1. Has terminado de migrar del antiguo modelo Bucket al nuevo modelo Scopes and Collections de Couchbase 7.0.<\/p>\n<p>Espero que el nuevo modelo de datos Colecciones te resulte m\u00e1s potente e intuitivo, y que tus consultas N1QL se simplifiquen y agilicen como resultado.<\/p>\n<p>Si desea obtener m\u00e1s informaci\u00f3n sobre la versi\u00f3n 7.0 de Couchbase Server, <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/introduction\/whats-new.html?ref=blog\" target=\"_blank\" rel=\"noopener\">Novedades<\/a> y\/o <a href=\"https:\/\/docs.couchbase.com\/server\/7.0\/release-notes\/relnotes.html?ref=blog\" target=\"_blank\" rel=\"noopener\">las notas de la versi\u00f3n 7.0<\/a>.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 30px\" aria-hidden=\"true\"><\/div>\n<div style=\"text-align: center\"><strong>\u00bfListo para realizar algunas consultas N1QL?<a href=\"https:\/\/www.couchbase.com\/blog\/es\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">Pruebe Couchbase 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 looking to migrate your data from a relational database to NoSQL, then now&#8217;s a better time than ever. The recent release of Couchbase 7.0 introduced Scopes and Collections \u2013 a new way to organize your JSON data. More [&hellip;]<\/p>\n","protected":false},"author":26326,"featured_media":11722,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1816,1819,2453,9336,1812],"tags":[9350,9367,9348,1766,9302,2267,1514,1725,9301],"ppma_author":[8919],"class_list":["post-9756","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-server","category-data-modeling","category-global-secondary-index","category-scopes-and-collections","category-n1ql-query","tag-cbq-shell","tag-data-definition-language","tag-data-manipulation-language","tag-data-migration","tag-data-model","tag-ddl","tag-dml","tag-nosql-database","tag-relational-database"],"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>N1QL Queries: 5 Steps to Streamline Migration to Collections<\/title>\n<meta name=\"description\" content=\"Need a collections data model to be more powerful and intuitive? This Couchbase post will help simplify and streamline N1QL queries as a result.\" \/>\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\/simplifying-query-index-with-collections\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections\" \/>\n<meta property=\"og:description\" content=\"Need a collections data model to be more powerful and intuitive? This Couchbase post will help simplify and streamline N1QL queries as a result.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/simplifying-query-index-with-collections\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-16T07:00:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T01:43:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model-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=\"Binh Le\" \/>\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\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model-social.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Binh Le\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/\"},\"author\":{\"name\":\"Binh Le\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/f89064928e262c71eb43bee996c48c63\"},\"headline\":\"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections\",\"datePublished\":\"2021-08-16T07:00:46+00:00\",\"dateModified\":\"2025-06-14T01:43:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/\"},\"wordCount\":1640,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2020\\\/11\\\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg\",\"keywords\":[\"cbq shell\",\"Data Definition Language\",\"Data Manipulation Language\",\"Data Migration\",\"data model\",\"DDL\",\"dml\",\"NoSQL Database\",\"relational database\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Server\",\"Data Modeling\",\"Global Secondary Index\",\"Scopes and Collections\",\"SQL++ \\\/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/\",\"name\":\"N1QL Queries: 5 Steps to Streamline Migration to Collections\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2020\\\/11\\\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg\",\"datePublished\":\"2021-08-16T07:00:46+00:00\",\"dateModified\":\"2025-06-14T01:43:32+00:00\",\"description\":\"Need a collections data model to be more powerful and intuitive? This Couchbase post will help simplify and streamline N1QL queries as a result.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2020\\\/11\\\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2020\\\/11\\\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg\",\"width\":1200,\"height\":628,\"caption\":\"Learn how to simplify your N1QL queries by migrating to Scopes and Collections in Couchbase 7.0\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/simplifying-query-index-with-collections\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections\"}]},{\"@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\\\/f89064928e262c71eb43bee996c48c63\",\"name\":\"Binh Le\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g5b68c37e30928a9d7b2c8470b1a303b7\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g\",\"caption\":\"Binh Le\"},\"description\":\"Binh Le is a Principal Product Manager for Couchbase Query service. Prior to Couchbase, he worked at Oracle and led the product management team for Sales Cloud Analytics and CRM OnDemand. Binh holds a Bachelor's Degree in Computer Science from the University of Brighton, UK.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/binh-le-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"N1QL Queries: 5 Steps to Streamline Migration to Collections","description":"\u00bfNecesitas que un modelo de datos de colecciones sea m\u00e1s potente e intuitivo? Este post de Couchbase ayudar\u00e1 a simplificar y agilizar las consultas N1QL como resultado.","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\/simplifying-query-index-with-collections\/","og_locale":"es_MX","og_type":"article","og_title":"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections","og_description":"Need a collections data model to be more powerful and intuitive? This Couchbase post will help simplify and streamline N1QL queries as a result.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/simplifying-query-index-with-collections\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-08-16T07:00:46+00:00","article_modified_time":"2025-06-14T01:43:32+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model-social.jpg","type":"image\/jpeg"}],"author":"Binh Le","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model-social.jpg","twitter_misc":{"Written by":"Binh Le","Est. reading time":"8 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/"},"author":{"name":"Binh Le","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f89064928e262c71eb43bee996c48c63"},"headline":"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections","datePublished":"2021-08-16T07:00:46+00:00","dateModified":"2025-06-14T01:43:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/"},"wordCount":1640,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg","keywords":["cbq shell","Data Definition Language","Data Manipulation Language","Data Migration","data model","DDL","dml","NoSQL Database","relational database"],"articleSection":["Best Practices and Tutorials","Couchbase Server","Data Modeling","Global Secondary Index","Scopes and Collections","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/","url":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/","name":"N1QL Queries: 5 Steps to Streamline Migration to Collections","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg","datePublished":"2021-08-16T07:00:46+00:00","dateModified":"2025-06-14T01:43:32+00:00","description":"\u00bfNecesitas que un modelo de datos de colecciones sea m\u00e1s potente e intuitivo? Este post de Couchbase ayudar\u00e1 a simplificar y agilizar las consultas N1QL como resultado.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/11\/5-steps-simplify-your-n1ql-database-queries-migration-collections-model.jpg","width":1200,"height":628,"caption":"Learn how to simplify your N1QL queries by migrating to Scopes and Collections in Couchbase 7.0"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/simplifying-query-index-with-collections\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"5 Steps to Streamline Your N1QL Queries &amp; Migrate to Collections"}]},{"@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\/f89064928e262c71eb43bee996c48c63","name":"Binh Le","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g5b68c37e30928a9d7b2c8470b1a303b7","url":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","caption":"Binh Le"},"description":"Binh Le is a Principal Product Manager for Couchbase Query service. Prior to Couchbase, he worked at Oracle and led the product management team for Sales Cloud Analytics and CRM OnDemand. Binh holds a Bachelor's Degree in Computer Science from the University of Brighton, UK.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/binh-le-2\/"}]}},"acf":[],"authors":[{"term_id":8919,"user_id":26326,"is_guest":0,"slug":"binh-le-2","display_name":"Binh Le","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/9756","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\/26326"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=9756"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/9756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/11722"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=9756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=9756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=9756"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=9756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}