{"id":5911,"date":"2018-10-20T18:06:25","date_gmt":"2018-10-21T01:06:25","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=5911"},"modified":"2025-06-13T22:39:36","modified_gmt":"2025-06-14T05:39:36","slug":"using-n1ql-with-couchbase-eventing-functions","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/using-n1ql-with-couchbase-eventing-functions\/","title":{"rendered":"Uso de N1QL con funciones de eventos de Couchbase."},"content":{"rendered":"<blockquote><p><span style=\"font-weight: 400\">Ahora bien, esto no es el fin. Ni siquiera es el principio del fin. <\/span><span style=\"font-weight: 400\">Pero es, quiz\u00e1s, el final del principio. - Winston Churchill<\/span><\/p><\/blockquote>\n<p><span style=\"font-weight: 400\">La actualizaci\u00f3n de datos no suele ser el final, sino el progreso de un flujo de trabajo.  El env\u00edo sigue al pedido; la actualizaci\u00f3n del inventario sigue al env\u00edo; el ajuste del cr\u00e9dito sigue a la devoluci\u00f3n; es necesario actuar en el siguiente paso del proceso para que el flujo de trabajo siga avanzando. Los flujos de trabajo pueden ser sencillos, con pocos pasos, o complejos, con cientos de pasos. \u00a0<\/span><a href=\"https:\/\/en.wikipedia.org\/wiki\/Business_process_management\"><span style=\"font-weight: 400\">Gesti\u00f3n de procesos empresariales<\/span><\/a><span style=\"font-weight: 400\"> (BPM) es una industria en s\u00ed misma.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Presentaci\u00f3n de Couchbase 5.5 <a href=\"https:\/\/docs.couchbase.com\/server\/6.0\/eventing\/eventing-overview.html\">Servicio nocturno<\/a>. Los desarrolladores pueden escribir una funci\u00f3n Javascript que se ejecute cuando se produzca un cambio en los datos. Nos referimos a las inserciones, actualizaciones, fusiones y eliminaciones como <\/span><i><span style=\"font-weight: 400\">mutaciones.<\/span><\/i><span style=\"font-weight: 400\"> M\u00faltiples casos de uso espec\u00edficos <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/eventing\/eventing-overview.html\"><span style=\"font-weight: 400\">se han documentado<\/span><\/a><span style=\"font-weight: 400\"> para desarrollar estos <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/eventing\/\">concurso<\/a> funciones.<\/span><\/p>\n<p><a href=\"https:\/\/www.json.org\"><span style=\"font-weight: 400\">JSON<\/span><\/a><span style=\"font-weight: 400\"> modelo de datos de Couchbase procede de <\/span><a href=\"https:\/\/en.wikipedia.org\/wiki\/JavaScript\"><span style=\"font-weight: 400\">JavaScript<\/span><\/a><span style=\"font-weight: 400\">. \u00a0<\/span><a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/n1ql\/n1ql-language-reference\/index.html\"><span style=\"font-weight: 400\">N1QL<\/span><\/a><span style=\"font-weight: 400\"> es SQL para JSON. Las funciones eventing est\u00e1n escritas en Javascript y tiene integrado N1QL. El uso de las funciones Eventing, escribir l\u00f3gica de negocio de procedimiento con acceso instant\u00e1neo a los datos f\u00e1cil.<\/span><\/p>\n<pre class=\"theme:github font:consolas wrap:true whitespace-before:1 whitespace-after:1 lang:js decode:true\" title=\"Ejemplo de funci\u00f3n de eventos para insertar y actualizar\">\/\/ Funci\u00f3n de recuento simple\r\n\/\/ Despu\u00e9s de cada actualizaci\u00f3n de la muestra de viaje, lleva la cuenta del n\u00famero total de documentos de cada tipo.\r\nfunction OnUpdate(doc, meta) {\r\n    try {\r\n   \r\n    \/\/ Emite una sentencia SELECT para obtener los recuentos.\r\n    var ginfo = SELECT type, COUNT(type) typecount FROM `travel-sample` WHERE `type` IS NOT MISSING GROUP BY type;\r\n\r\n    \/\/ bucle a trav\u00e9s del conjunto de resultados\r\n    for (var val of ginfo) {\r\n      var ckey = \"trcount\" + val.type; \/\/ Crea la cadena de claves del documento.\r\n      var vtype = val.type; var vtc = val.typecount; \/\/ obtener el tipo, contar\r\n      \/\/ hacer la actualizaci\u00f3n.\r\n      UPDATE T1 USE KEYS[$ckey] SET type = $vtype, typecount =$vtc;\r\n    }\r\n  } catch(e) { log(e); }    \r\n}\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Este es el ciclo de vida de las funciones desde la perspectiva del desarrollador. Para cada mutaci\u00f3n, se puede definir cualquier n\u00famero de estas funciones a ejecutar. Es responsabilidad del desarrollador dimensionar los tiempos de ejecuci\u00f3n de las funciones, en funci\u00f3n del n\u00famero de mutaciones.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Este es el ciclo de vida de las funciones de Eventing:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/lifecycle-overview-5.5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-8363\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/10\/lifecycle-overview-5.5-300x150.png\" alt=\"\" width=\"855\" height=\"428\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5-300x150.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5-1024x511.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5-768x383.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5-20x10.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5-1320x659.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png 1394w\" sizes=\"auto, (max-width: 855px) 100vw, 855px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Para cada inserci\u00f3n, actualizaci\u00f3n o supresi\u00f3n (directa o por expiraci\u00f3n), puede ejecutar una o varias funciones javascript.  Estas funciones pueden leer los nuevos datos y el tipo de acci\u00f3n y luego ejecutar la acci\u00f3n subsiguiente. Esta funcionalidad est\u00e1 bien descrita en los blogs y art\u00edculos de Couchbase.<\/span><\/p>\n<div class=\"responsive-table\">\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Tipo de declaraci\u00f3n<\/span><\/td>\n<td><span style=\"font-weight: 400\">Funci\u00f3n de eventos invocada<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECCIONE<\/span><\/td>\n<td><span style=\"font-weight: 400\">Ninguno<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">INSERTAR <\/span><\/td>\n<td><span style=\"font-weight: 400\">OnUpdate().  La funci\u00f3n se invoca <\/span><b>una vez por documento insertado. <\/b><span style=\"font-weight: 400\">La inserci\u00f3n simple inserta un \u00fanico documento. Las inserciones pueden tener varios documentos utilizando varios documentos en la cl\u00e1usula VALUES o pueden insertar varios documentos mediante la sentencia INSERT INTO...SELECT.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">ACTUALIZACI\u00d3N<\/span><\/td>\n<td><span style=\"font-weight: 400\">Se invoca OnUpdate() <\/span><b>una vez por documento actualizado, excepto cuando varias actualizaciones de un mismo documento se deduzcan en una sola actualizaci\u00f3n. <\/b><span style=\"font-weight: 400\">La sentencia Update puede actualizar varios documentos.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">UPSERT<\/span><\/td>\n<td><span style=\"font-weight: 400\">OnUpdate().  El comportamiento es similar a INSERT.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">BORRAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">OnDelete(). Se invoca una vez por cada documento eliminado.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">FUSIONAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">OnUpdate() y\/o OnDelete() en funci\u00f3n de las acciones de inserci\u00f3n, actualizaci\u00f3n y eliminaci\u00f3n. <\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">CREAR \u00cdNDICE, ELIMINAR \u00cdNDICE, EXPLICAR, PREPARAR, CONCEDER, REVOCAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">No se invoca ninguna funci\u00f3n de eventos.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">EJECUTAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">Depende del tipo de sentencia ejecutada.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><span style=\"font-weight: 400\">Estas funciones tambi\u00e9n pueden ejecutar sentencias N1QL.  Resto del art\u00edculo se ve en todos los aspectos de N1QL ejecutado en Funciones Eventing.<\/span><\/p>\n<p><b>Declaraciones N1QL en funciones Eventing.<\/b><\/p>\n<div class=\"responsive-table\">\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Declaraci\u00f3n<\/span><\/td>\n<td><span style=\"font-weight: 400\">Casos de uso de las sentencias N1QL en las funciones de eventos<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">CREAR \u00cdNDICE<\/span><\/td>\n<td><span style=\"font-weight: 400\">Dado que el esquema es flexible, podr\u00eda inspeccionar los datos a menudo\/peri\u00f3dicamente para detectar nuevos campos y luego crear \u00edndices sobre ellos.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">BORRAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">Borrado en cascada.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DROP INDEX<\/span><\/td>\n<td><span style=\"font-weight: 400\">Corolario del caso de uso CREAR \u00cdNDICE.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">INFER<\/span><\/td>\n<td><span style=\"font-weight: 400\">Introspecci\u00f3n peri\u00f3dica del cubo para la estructura.  A continuaci\u00f3n, tomar medidas (validar, crear \u00edndice, actualizar el modelo de datos) si es necesario.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">INSERTAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">Mantener datos referenciales (eventualmente).<\/span><\/p>\n<p><span style=\"font-weight: 400\">Actualizar otros documentos con referencias a estos datos.  Por ejemplo, datos de un nuevo c\u00f3digo postal, estado, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Copia de datos (total o parcialmente) en documentos secundarios\/terciarios. Similar a la acci\u00f3n posterior a la activaci\u00f3n.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">FUSIONAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">Mant\u00e9n sincronizados los datos secundarios.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECCIONE<\/span><\/td>\n<td><span style=\"font-weight: 400\">Obtener datos, ejecutar informes peri\u00f3dicamente, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Compruebe diversos aspectos, como la calidad y la validez de los datos, <\/span><\/p>\n<p><span style=\"font-weight: 400\">Si conoce la clave del documento de destino, utilice las referencias directas incorporadas. Vea ejemplos en: <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/eventing\/eventing-examples.html\"><span style=\"font-weight: 400\">https:\/\/docs.couchbase.com\/server\/5.5\/eventing\/eventing-examples.html<\/span><\/a><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">UPSERT<\/span><\/td>\n<td><span style=\"font-weight: 400\">Mantener sincronizados los datos secundarios y terciarios.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Similar a la acci\u00f3n posterior al disparo.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">ACTUALIZACI\u00d3N<\/span><\/td>\n<td><span style=\"font-weight: 400\">Mantener sincronizados los datos secundarios y terciarios.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Similar a la acci\u00f3n posterior al disparo.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Ejemplos:  Probemos algunas funciones eventing con N1QL.<\/p>\n<pre class=\"theme:github wrap:true scroll:true whitespace-before:1 whitespace-after:1 lang:js decode:true\" title=\"Datos iniciales\">select meta().id, * from ejecutar S1;\r\n\r\n[\r\n  {\r\n    \"S1\": {\r\n      \"nombre\": \"Joe Smith\",\r\n      \"zip\": \"94501\"\r\n    },\r\n    \"id\": \"Joe::94040\"\r\n  },\r\n  {\r\n    \"S1\": {\r\n      \"nombre\": \"John Smith\",\r\n      \"zip\": \"94040\"\r\n    },\r\n    \"id\": \"John::94040\"\r\n  }\r\n]\r\n\r\n\r\n\r\nselect meta().id, * from S2;\r\n\r\n\r\n[\r\n  {\r\n    \"S2\": {\r\n      \"nombre\": \"Joe Smith\",\r\n      \"zip\": \"94501\"\r\n    },\r\n    \"id\": \"Joe::94040\"\r\n  },\r\n  {\r\n    \"S2\": {\r\n      \"nombre\": \"John Smith\",\r\n      \"zip\": \"94040\"\r\n    },\r\n    \"id\": \"John::94040\"\r\n  }\r\n]\r\n\r\n\r\nselect meta().id, * from T1;\r\n<\/pre>\n<ol>\n<li><b>N1QL simple en Funciones para registro y borrado en cascada.<\/b><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Guarda cada documento eliminado en un cubo aparte.<\/span><\/p>\n<pre class=\"theme:github lang:js decode:true\" title=\"Ejemplo completo.\">function OnUpdate(doc, meta) {\r\n}\r\nfunction OnDelete(meta) {\r\n  try {\r\n      var myid = meta.id;\r\n      \/\/Insertar en el bucket de\r\n      INSERT INTO T1 VALUES(UUID(), {\"type\" : \"deleted\", \"docid\":$myid});\r\n      \/\/Eliminaci\u00f3n en cascada\r\n      DELETE FROM S2 USE KEYS [$myid];\r\n  } catch(e) { log(e); }\r\n}\r\n\r\nDespu\u00e9s de crear la funci\u00f3n anterior, la aplicaci\u00f3n ejecuta lo siguiente:\r\n\r\nDELETE FROM S1 WHERE zip = \"94040\";\r\n\/\/ Se ha borrado un documento.\r\n\r\nSELECT meta().id, * from S1;\r\n\/\/ se acaba de borrar un documento. S\u00f3lo deber\u00eda quedar un documento.\r\n[\r\n  {\r\n    \"S1\": {\r\n      \"nombre\": \"Joe Smith\",\r\n      \"zip\": \"94501\"\r\n    },\r\n    \"id\": \"Joe::94040\"\r\n  }\r\n]\r\n\r\n\r\n\r\nSELECT meta().id, * from T1;\r\n\/\/ Deber\u00edamos ver un registro de los borrados\r\n[\r\n  {\r\n    \"T1\": {\r\n      \"docid\": \"John::94040\",\r\n      \"type\": \"deleted\"\r\n    },\r\n    \"id\": \"2dc9b33d-3cd4-422e-af9c-b0c664c4660f\"\r\n  }\r\n]\r\n\r\nSELECT meta().id, * FROM S2;\r\n\/\/ S\u00f3lo deber\u00edamos ver un documento debido al efecto de borrado en cascada de la funci\u00f3n\r\n[\r\n  {\r\n    \"S2\": {\r\n      \"nombre\": \"Joe Smith\",\r\n      \"zip\": \"94501\"\r\n    },\r\n    \"id\": \"Joe::94040\"\r\n  }\r\n]\r\n<\/pre>\n<ol start=\"2\">\n<li><b>OnUpdate() para mantener la informaci\u00f3n agregada lista peri\u00f3dicamente.<\/b><\/li>\n<\/ol>\n<pre class=\"theme:github wrap:true whitespace-before:1 whitespace-after:1 lang:js decode:true\" title=\"Informes peri\u00f3dicos\">function OnUpdate(doc, meta) {\r\n    try {\r\n        var stattime = SELECT lastupdate FROM T1 USE KEYS [\"trstattime\"];\r\n        for (var t of stattime) {\r\n            var lt = t.lastupdate;\r\n            var d = new Date();\r\n            var n = d.getTime();\r\n            \/\/ Cada 10 minutos o m\u00e1s\r\n            if ((n - lt) &gt; (1000 * 60 * 10)) {\r\n                UPDATE T1 USE KEYS[\"trstattime\"] SET lastupdate = NOW_MILLIS() ;\r\n                var ginfo = SELECT type, count(type) typecount FROM `travel-sample` WHERE `type` IS NOT MISSING GROUP BY type;\r\n                for (var val of ginfo) {\r\n                   var ckey = \"trcount::\" + val.type;\r\n                   var vtype = val.type; var vtc = val.typecount;\r\n                   UPDATE T1 USE KEYS[$ckey] SET type = $vtype, typecount = $vtc;\r\n                }\r\n        }\r\n     }\r\n    } catch(e) { log(e); }    \r\n}\r\n\r\n<\/pre>\n<p><strong>Referencias:<\/strong><\/p>\n<ol>\n<li>Documentaci\u00f3n de Couchbase:\u00a0<a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/eventing\/eventing-overview.html\">https:\/\/docs.couchbase.com\/server\/5.5\/eventing\/eventing-overview.html<\/a><\/li>\n<li>Blogs de Couchbase sobre eventing:\u00a0<a href=\"https:\/\/www.couchbase.com\/blog\/es\/tag\/eventing\/\">https:\/\/www.couchbase.com\/blog\/tag\/eventing\/<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Now, this is not the end. It is not even the beginning of the end. But it is, perhaps, the end of the beginning. &#8212; Winston Churchill Updating data is usually not the end, but usually a progress of a [&hellip;]<\/p>","protected":false},"author":55,"featured_media":8363,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1821,1816,2273,1812],"tags":[2134,2133,2290],"ppma_author":[8929],"class_list":["post-5911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-architecture","category-couchbase-server","category-eventing","category-n1ql-query","tag-actions","tag-functions","tag-workflow"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using N1QL with Couchbase Eventing Functions. - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/using-n1ql-with-couchbase-eventing-functions\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using N1QL with Couchbase Eventing Functions.\" \/>\n<meta property=\"og:description\" content=\"Now, this is not the end. It is not even the beginning of the end. But it is, perhaps, the end of the beginning. &#8212; Winston Churchill Updating data is usually not the end, but usually a progress of a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/using-n1ql-with-couchbase-eventing-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-21T01:06:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T05:39:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1394\" \/>\n\t<meta property=\"og:image:height\" content=\"696\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Keshav Murthy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rkeshavmurthy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Keshav Murthy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/\"},\"author\":{\"name\":\"Keshav Murthy\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636\"},\"headline\":\"Using N1QL with Couchbase Eventing Functions.\",\"datePublished\":\"2018-10-21T01:06:25+00:00\",\"dateModified\":\"2025-06-14T05:39:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/\"},\"wordCount\":662,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png\",\"keywords\":[\"actions\",\"functions\",\"workflow\"],\"articleSection\":[\"Couchbase Architecture\",\"Couchbase Server\",\"Eventing\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/\",\"name\":\"Using N1QL with Couchbase Eventing Functions. - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png\",\"datePublished\":\"2018-10-21T01:06:25+00:00\",\"dateModified\":\"2025-06-14T05:39:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png\",\"width\":1394,\"height\":696,\"caption\":\"Eventing Life Cycle 5.5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using N1QL with Couchbase Eventing Functions.\"}]},{\"@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\/c261644262bf98e146372fe647682636\",\"name\":\"Keshav Murthy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4e51d72fc07c662aa791316deafffac4\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g\",\"caption\":\"Keshav Murthy\"},\"description\":\"Keshav Murthy is a Vice President at Couchbase R&amp;D. Previously, he was at MapR, IBM, Informix, Sybase, with more than 20 years of experience in database design &amp; development. He lead the SQL and NoSQL R&amp;D team at IBM Informix. He has received two President's Club awards at Couchbase, two Outstanding Technical Achievement Awards at IBM. Keshav has a bachelor's degree in Computer Science and Engineering from the University of Mysore, India, holds eleven US patents and has four US patents pending.\",\"sameAs\":[\"https:\/\/blog.planetnosql.com\/\",\"https:\/\/x.com\/rkeshavmurthy\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/keshav-murthy\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using N1QL with Couchbase Eventing Functions. - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/using-n1ql-with-couchbase-eventing-functions\/","og_locale":"es_MX","og_type":"article","og_title":"Using N1QL with Couchbase Eventing Functions.","og_description":"Now, this is not the end. It is not even the beginning of the end. But it is, perhaps, the end of the beginning. &#8212; Winston Churchill Updating data is usually not the end, but usually a progress of a [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/using-n1ql-with-couchbase-eventing-functions\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-10-21T01:06:25+00:00","article_modified_time":"2025-06-14T05:39:36+00:00","og_image":[{"width":1394,"height":696,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png","type":"image\/png"}],"author":"Keshav Murthy","twitter_card":"summary_large_image","twitter_creator":"@rkeshavmurthy","twitter_misc":{"Written by":"Keshav Murthy","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/"},"author":{"name":"Keshav Murthy","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636"},"headline":"Using N1QL with Couchbase Eventing Functions.","datePublished":"2018-10-21T01:06:25+00:00","dateModified":"2025-06-14T05:39:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/"},"wordCount":662,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png","keywords":["actions","functions","workflow"],"articleSection":["Couchbase Architecture","Couchbase Server","Eventing","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/","url":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/","name":"Using N1QL with Couchbase Eventing Functions. - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png","datePublished":"2018-10-21T01:06:25+00:00","dateModified":"2025-06-14T05:39:36+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/10\/lifecycle-overview-5.5.png","width":1394,"height":696,"caption":"Eventing Life Cycle 5.5"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/using-n1ql-with-couchbase-eventing-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using N1QL with Couchbase Eventing Functions."}]},{"@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\/c261644262bf98e146372fe647682636","name":"Keshav Murthy","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4e51d72fc07c662aa791316deafffac4","url":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","caption":"Keshav Murthy"},"description":"Keshav Murthy es Vicepresidente de Couchbase R&amp;D. Anteriormente, estuvo en MapR, IBM, Informix, Sybase, con m\u00e1s de 20 a\u00f1os de experiencia en dise\u00f1o y desarrollo de bases de datos. Dirigi\u00f3 el equipo de I+D de SQL y NoSQL en IBM Informix. Ha recibido dos premios President's Club en Couchbase y dos premios Outstanding Technical Achievement en IBM. Keshav es licenciado en Inform\u00e1tica e Ingenier\u00eda por la Universidad de Mysore (India), es titular de once patentes estadounidenses y tiene cuatro pendientes.","sameAs":["https:\/\/blog.planetnosql.com\/","https:\/\/x.com\/rkeshavmurthy"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/keshav-murthy\/"}]}},"authors":[{"term_id":8929,"user_id":55,"is_guest":0,"slug":"keshav-murthy","display_name":"Keshav Murthy","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","first_name":"Keshav","last_name":"Murthy","user_url":"https:\/\/blog.planetnosql.com\/","author_category":"","description":"Keshav Murthy es Vicepresidente de Couchbase R&amp;D. Anteriormente, estuvo en MapR, IBM, Informix, Sybase, con m\u00e1s de 20 a\u00f1os de experiencia en dise\u00f1o y desarrollo de bases de datos. Dirigi\u00f3 el equipo de I+D de SQL y NoSQL en IBM Informix. Ha recibido dos premios President's Club en Couchbase y dos premios Outstanding Technical Achievement en IBM. Keshav es licenciado en Inform\u00e1tica e Ingenier\u00eda por la Universidad de Mysore (India), es titular de diez patentes estadounidenses y tiene tres pendientes."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/5911","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\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=5911"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/5911\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/8363"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=5911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=5911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=5911"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=5911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}