{"id":10499,"date":"2021-01-27T08:16:01","date_gmt":"2021-01-27T16:16:01","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=10499"},"modified":"2025-06-13T17:32:23","modified_gmt":"2025-06-14T00:32:23","slug":"query-couchbase-data-structures-with-n1ql-sql-for-json","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/query-couchbase-data-structures-with-n1ql-sql-for-json\/","title":{"rendered":"Estruturas de dados e consultas com o Couchbase N1QL (SQL para JSON)"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">No <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/data-structures-for-nosql-applications-in-couchbase-7-0\/\"><span style=\"font-weight: 400;\">Estruturas de dados para aplicativos NoSQL<\/span><\/a> postar,<span style=\"font-weight: 400;\"> usamos o acesso simplificado a dados JSON por meio de cole\u00e7\u00f5es nativas, mapas e muito mais. <\/span><span style=\"font-weight: 400;\">Esta postagem demonstra a consulta desses dados usando consultas N1QL de n\u00edvel superior, a linguagem baseada em SQL para JSON.<\/span><\/p>\n<div id=\"attachment_10151\" style=\"width: 778px\" class=\"wp-caption alignnone\"><a style=\"background-color: initial;\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/data-structures-for-nosql-applications-in-couchbase-7-0\/\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10151\" class=\"wp-image-10151 size-medium_large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2020\/12\/couchbase_data_structures_cheatsheet-768x413.png\" alt=\"chart of couchbase data structures and examples\" width=\"768\" height=\"413\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/couchbase_data_structures_cheatsheet-768x413.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/couchbase_data_structures_cheatsheet-300x161.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/couchbase_data_structures_cheatsheet-1024x550.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/couchbase_data_structures_cheatsheet-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/couchbase_data_structures_cheatsheet.png 1152w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><p id=\"caption-attachment-10151\" class=\"wp-caption-text\">Resumo dos tipos de estrutura de dados do Couchbase e amostras de JSON.<\/p><\/div>\n<p><span style=\"font-weight: 400;\">Os desenvolvedores podem se concentrar no gerenciamento de estruturas de dados b\u00e1sicas e tipos de dados usando linguagens de programa\u00e7\u00e3o. Enquanto isso, os DBAs e os analistas podem acessar os mesmos dados usando uma linguagem de consulta. O Couchbase faz isso usando m\u00e9todos de indexa\u00e7\u00e3o de dados NoSQL e servi\u00e7os de consulta N1QL.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As consultas de pesquisa com o mecanismo de pesquisa de texto completo do Couchbase tamb\u00e9m s\u00e3o poss\u00edveis e ser\u00e3o abordadas em um post futuro.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">O que \u00e9 indexa\u00e7\u00e3o de banco de dados NoSQL?\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A indexa\u00e7\u00e3o examina os dados e determina como encontrar esses elementos novamente. A indexa\u00e7\u00e3o pode ser aplicada a documentos JSON, chaves\/campos ou valores em campos. As chaves em documentos JSON funcionam como nomes de colunas em sistemas de indexa\u00e7\u00e3o de bancos de dados tabulares.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">O banco de dados gerencia essas cole\u00e7\u00f5es de elementos e valores como \u00edndices que apontam para a fonte. O backend do banco de dados atualiza a indexa\u00e7\u00e3o \u00e0 medida que os documentos s\u00e3o alterados durante o armazenamento de dados. Enquanto isso, os DBAs podem otimizar a indexa\u00e7\u00e3o para casos de uso espec\u00edficos, como grava\u00e7\u00f5es ou consultas de alto volume.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Com o uso de \u00edndices, as consultas N1QL podem encontrar rapidamente os valores de campo correspondentes sem precisar examinar os dados originais. Esse m\u00e9todo tamb\u00e9m se aplica \u00e0s estruturas de dados comuns, <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/simplifying-query-index-with-collections\/\"><span style=\"font-weight: 400;\">cole\u00e7\u00f5es e escopos introduzidos em <\/span><b>Couchbase 7.0<\/b><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Consulta de estruturas de dados do Couchbase com N1QL<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">O console da Web do Couchbase \u00e9 uma maneira f\u00e1cil de visualizar documentos de estrutura de dados no banco de dados. Observe como os documentos de estrutura de dados geralmente s\u00e3o muito mais simples do que os documentos JSON mais complexos.<\/span><\/p>\n<div id=\"attachment_10500\" style=\"width: 1392px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10500\" class=\"size-full wp-image-10500\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-doc-preview.png\" alt=\"data structure documents listed in the bucket preview screen\" width=\"1382\" height=\"461\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview.png 1382w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview-300x100.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview-1024x342.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview-768x256.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview-20x7.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-doc-preview-1320x440.png 1320w\" sizes=\"auto, (max-width: 1382px) 100vw, 1382px\" \/><p id=\"caption-attachment-10500\" class=\"wp-caption-text\">Lista de documentos de estrutura de dados no bucket<\/p><\/div>\n<p><span style=\"font-weight: 400;\">Para come\u00e7ar a escrever consultas N1QL, \u00e9 necess\u00e1rio indexar os dados de sua estrutura de dados. \u00c9 necess\u00e1rio, no m\u00ednimo, um \u00edndice prim\u00e1rio em todo o bucket para opera\u00e7\u00f5es b\u00e1sicas.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">CREATE PRIMARY INDEX ON `travel-sample`;<\/pre>\n<p><span style=\"font-weight: 400;\">Para documentos que usam os novos recursos de cole\u00e7\u00f5es de <\/span><b>Couchbase 7.0<\/b><span style=\"font-weight: 400;\">eles tamb\u00e9m devem ser indexados.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">CREATE PRIMARY INDEX ON `travel-sample`.`scope1`.`col1`<\/pre>\n<p><strong>P<\/strong><b>\u00edndices secund\u00e1rios <\/b>dificuldade com grandes conjuntos de dados<span style=\"font-weight: 400;\"> mas s\u00e3o excelentes para explorar rapidamente pequenas quantidades de dados. Use os \u00edndices secund\u00e1rios globais (GSI) ao passar para a produ\u00e7\u00e3o em um projeto de Big Data.<\/span><\/p>\n<h2>Listagem de todos os documentos de dados e IDs<\/h2>\n<p><span style=\"font-weight: 400;\">Entretanto, uma indexa\u00e7\u00e3o mais direcionada nem sempre \u00e9 poss\u00edvel, pois as estruturas de dados podem n\u00e3o ter chaves nomeadas. <\/span><span style=\"font-weight: 400;\">Por exemplo, um contador \u00e9 apenas um ID e um valor inteiro sem nome de campo. Por\u00e9m, se voc\u00ea tiver um mapa, poder\u00e1 criar um \u00edndice que tenha como alvo uma chave interna.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Uma consulta b\u00e1sica para o ID do documento pode retornar todos os documentos e mostrar os nomes de campo que est\u00e3o sendo usados.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT META().id, * FROM `travel-sample`<\/pre>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10501 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql1.png\" alt=\"query results showing data structure documents\" width=\"926\" height=\"1050\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1.png 926w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1-265x300.png 265w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1-903x1024.png 903w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1-768x871.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1-300x340.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql1-18x20.png 18w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><\/a><\/p>\n<p><i><span style=\"font-weight: 400;\">CurrentScore <\/span><\/i><span style=\"font-weight: 400;\">\u00e9 um contador b\u00e1sico, enquanto <\/span><i><span style=\"font-weight: 400;\">gameList <\/span><\/i><span style=\"font-weight: 400;\">\u00e9 uma lista\/cole\u00e7\u00e3o, etc.<\/span><\/p>\n<h3>Consulta de escopos\/cole\u00e7\u00f5es para estruturas de dados<\/h3>\n<p><span style=\"font-weight: 400;\">Se estiver usando escopos e cole\u00e7\u00f5es, adicione-os \u00e0 cl\u00e1usula from.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT * FROM `travel-sample`.`scope1`.`col1`<\/pre>\n<p><span style=\"font-weight: 400;\">Recupere um valor espec\u00edfico de um objeto de estrutura de dados nomeado, adicionando-o \u00e0 cl\u00e1usula where.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT META().id, * FROM `travel-sample` WHERE META().id = 'currentScore'<\/pre>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10502 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql2.png\" alt=\"JSON query results showing a document ID and counter value\" width=\"916\" height=\"263\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql2.png 916w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql2-300x86.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql2-768x221.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql2-20x6.png 20w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Ao especificar nomes de campo (e nenhum ID), a consulta retorna valores correspondentes em todos os documentos.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT nome, contato FROM `travel-sample`<\/pre>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10503 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/01\/data-structure-query-results-n1ql3.png\" alt=\"JSON N1QL query showing records containing specific field names\" width=\"567\" height=\"613\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql3.png 567w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql3-277x300.png 277w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql3-300x324.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/data-structure-query-results-n1ql3-18x20.png 18w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">A consulta retorna objetos com os campos espec\u00edficos e seus valores. Nos resultados acima, apenas uma das estruturas de dados tinha o campo <\/span><i><span style=\"font-weight: 400;\">contato <\/span><\/i><span style=\"font-weight: 400;\">campo. Dois outros tinham um <\/span><i><span style=\"font-weight: 400;\">nome <\/span><\/i><span style=\"font-weight: 400;\">mas v\u00e1rios objetos em branco mostram que n\u00e3o havia campos correspondentes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Para serem dimension\u00e1veis, todos os aplicativos de consulta tamb\u00e9m devem usar \u00edndices secund\u00e1rios globais (GSI) para campos espec\u00edficos.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Isso <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/database-indexing-best-practices\/\"><span style=\"font-weight: 400;\">Pr\u00e1ticas recomendadas de indexa\u00e7\u00e3o de banco de dados<\/span><\/a><span style=\"font-weight: 400;\"> O artigo aborda mais cen\u00e1rios de ci\u00eancia da computa\u00e7\u00e3o usados na engenharia de software de Big Data.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Reunindo tudo isso<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Como voc\u00ea pode ver, a consulta de documentos e subcomponentes relacionados \u00e9 muito simples com o Couchbase. O uso estrat\u00e9gico de m\u00e9todos de indexa\u00e7\u00e3o sofisticados oferece ainda mais maneiras de acessar os dados que seus aplicativos est\u00e3o criando.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">O Couchbase simplifica drasticamente as arquiteturas de sistema, permitindo que os desenvolvedores comecem a trabalhar sem muito trabalho pesado. Essas refer\u00eancias o ajudar\u00e3o a come\u00e7ar rapidamente.<\/span><\/p>\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/data-structures-for-nosql-applications-in-couchbase-7-0\/\"><span style=\"font-weight: 400;\">Estruturas de dados para aplicativos NoSQL no Couchbase 7.0<\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0\/\">Escopos e cole\u00e7\u00f5es para aplicativos multilocat\u00e1rios<\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/docs.couchbase.com\/python-sdk\/2.5\/datastructures.html\"><span style=\"font-weight: 400;\">API de estruturas de dados do Couchbase<\/span><\/a><span style=\"font-weight: 400;\"> (Python SDK)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/subdocument-operations.html\"><span style=\"font-weight: 400;\">Opera\u00e7\u00f5es de subdocumentos docs<\/span><\/a><span style=\"font-weight: 400;\"> (Python SDK)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/database-indexing-best-practices\/\"><span style=\"font-weight: 400;\">Pr\u00e1ticas recomendadas de indexa\u00e7\u00e3o do sistema de banco de dados NoSQL<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/full-text-search-indexing-best-practices\/\"><span style=\"font-weight: 400;\">Pr\u00e1ticas recomendadas de indexa\u00e7\u00e3o de pesquisa de texto completo NoSQL<\/span><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/docs.couchbase.com\/server\/current\/fts\/full-text-intro.html\"><span style=\"font-weight: 400;\">Documenta\u00e7\u00e3o de pesquisa de texto completo<\/span><\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>In the Data Structures for NoSQL Applications post, we used simplified JSON data access through native collections, maps, and more. This post demonstrates querying that data using higher-level N1QL queries, the SQL-based language for JSON. Developers can focus on managing [&hellip;]<\/p>","protected":false},"author":75185,"featured_media":10506,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1821,1816,1819,2453,1812,2201],"tags":[1883,1800,1696,1261],"ppma_author":[9163],"class_list":["post-10499","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-architecture","category-couchbase-server","category-data-modeling","category-global-secondary-index","category-n1ql-query","category-tools-sdks","tag-data-modelling","tag-data-structures","tag-indexing","tag-json"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.7 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Data Structures &amp; Queries with Couchbase N1QL (SQL for JSON)<\/title>\n<meta name=\"description\" content=\"Access JSON NoSQL data with Couchbase data structures: maps, lists, counters, queues using N1QL\/SQL queries, indexes and efficient SDK calls.\" \/>\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\/pt\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Data Structures &amp; Queries with Couchbase N1QL (SQL for JSON)\" \/>\n<meta property=\"og:description\" content=\"Access JSON NoSQL data with Couchbase data structures: maps, lists, counters, queues using N1QL\/SQL queries, indexes and efficient SDK calls.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-27T16:16:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T00:32:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1575\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@1tylermitchell\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\"},\"author\":{\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0\"},\"headline\":\"Data Structures &#038; Queries with Couchbase N1QL (SQL for JSON)\",\"datePublished\":\"2021-01-27T16:16:01+00:00\",\"dateModified\":\"2025-06-14T00:32:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\"},\"wordCount\":666,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg\",\"keywords\":[\"data modelling\",\"Data structures\",\"Indexing\",\"JSON\"],\"articleSection\":[\"Couchbase Architecture\",\"Couchbase Server\",\"Data Modeling\",\"Global Secondary Index\",\"SQL++ \/ N1QL Query\",\"Tools &amp; SDKs\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\",\"name\":\"Data Structures & Queries with Couchbase N1QL (SQL for JSON)\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg\",\"datePublished\":\"2021-01-27T16:16:01+00:00\",\"dateModified\":\"2025-06-14T00:32:23+00:00\",\"description\":\"Access JSON NoSQL data with Couchbase data structures: maps, lists, counters, queues using N1QL\/SQL queries, indexes and efficient SDK calls.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg\",\"width\":1575,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Structures &#038; Queries with Couchbase N1QL (SQL for JSON)\"}]},{\"@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\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0\",\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/d8a7c532bf2b94b7a2fe7a8439aafd75\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"caption\":\"Tyler Mitchell - Senior Product Marketing Manager\"},\"description\":\"Works as Senior Product Marketing Manager at Couchbase, helping bring knowledge about products into the public limelight while also supporting our field teams with valuable content.\",\"sameAs\":[\"https:\/\/linkedin.com\/in\/tylermitchell\",\"https:\/\/x.com\/1tylermitchell\",\"https:\/\/www.youtube.com\/channel\/UCBZFuoiTcg0f3lGSQwLjeTg\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/tylermitchell\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Data Structures & Queries with Couchbase N1QL (SQL for JSON)","description":"Acesse dados JSON NoSQL com estruturas de dados do Couchbase: mapas, listas, contadores, filas usando consultas N1QL\/SQL, \u00edndices e chamadas SDK eficientes.","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\/pt\/query-couchbase-data-structures-with-n1ql-sql-for-json\/","og_locale":"pt_BR","og_type":"article","og_title":"Data Structures & Queries with Couchbase N1QL (SQL for JSON)","og_description":"Access JSON NoSQL data with Couchbase data structures: maps, lists, counters, queues using N1QL\/SQL queries, indexes and efficient SDK calls.","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/query-couchbase-data-structures-with-n1ql-sql-for-json\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-01-27T16:16:01+00:00","article_modified_time":"2025-06-14T00:32:23+00:00","og_image":[{"width":1575,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg","type":"image\/jpeg"}],"author":"Tyler Mitchell - Senior Product Marketing Manager","twitter_card":"summary_large_image","twitter_creator":"@1tylermitchell","twitter_misc":{"Written by":"Tyler Mitchell - Senior Product Marketing Manager","Est. reading time":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/"},"author":{"name":"Tyler Mitchell - Senior Product Marketing Manager","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0"},"headline":"Data Structures &#038; Queries with Couchbase N1QL (SQL for JSON)","datePublished":"2021-01-27T16:16:01+00:00","dateModified":"2025-06-14T00:32:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/"},"wordCount":666,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg","keywords":["data modelling","Data structures","Indexing","JSON"],"articleSection":["Couchbase Architecture","Couchbase Server","Data Modeling","Global Secondary Index","SQL++ \/ N1QL Query","Tools &amp; SDKs"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/","url":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/","name":"Data Structures & Queries with Couchbase N1QL (SQL for JSON)","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg","datePublished":"2021-01-27T16:16:01+00:00","dateModified":"2025-06-14T00:32:23+00:00","description":"Acesse dados JSON NoSQL com estruturas de dados do Couchbase: mapas, listas, contadores, filas usando consultas N1QL\/SQL, \u00edndices e chamadas SDK eficientes.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/01\/query-indexing-blogbanner.jpg","width":1575,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/query-couchbase-data-structures-with-n1ql-sql-for-json\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Data Structures &#038; Queries with Couchbase N1QL (SQL for JSON)"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados 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":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0","name":"Tyler Mitchell - Gerente s\u00eanior de marketing de produtos","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/d8a7c532bf2b94b7a2fe7a8439aafd75","url":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","caption":"Tyler Mitchell - Senior Product Marketing Manager"},"description":"Works as Senior Product Marketing Manager at Couchbase, helping bring knowledge about products into the public limelight while also supporting our field teams with valuable content.","sameAs":["https:\/\/linkedin.com\/in\/tylermitchell","https:\/\/x.com\/1tylermitchell","https:\/\/www.youtube.com\/channel\/UCBZFuoiTcg0f3lGSQwLjeTg"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/tylermitchell\/"}]}},"authors":[{"term_id":9163,"user_id":75185,"is_guest":0,"slug":"tylermitchell","display_name":"Tyler Mitchell - Senior Product Marketing Manager","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/876da1e4284f1832c871b3514caf7867357744b8c0a370ef6f53a79dee2f379e?s=96&d=mm&r=g","author_category":"","last_name":"Mitchell - Senior Product Marketing Manager","first_name":"Tyler","job_title":"Senior Product Marketing Manager","user_url":"","description":"Trabalha como Gerente S\u00eanior de Marketing de Produto na Couchbase, ajudando a levar o conhecimento sobre os produtos para o centro das aten\u00e7\u00f5es do p\u00fablico e, ao mesmo tempo, apoiando nossas equipes de campo com conte\u00fado valioso. Sua paix\u00e3o pessoal s\u00e3o todas as coisas geoespaciais, tendo trabalhado em GIS durante metade de sua carreira. Agora, a IA e a pesquisa vetorial est\u00e3o em sua mente."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/10499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/75185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=10499"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/10499\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/10506"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=10499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=10499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=10499"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=10499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}