{"id":1991,"date":"2015-10-21T17:34:07","date_gmt":"2015-10-21T17:34:07","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1991"},"modified":"2023-06-27T07:24:41","modified_gmt":"2023-06-27T14:24:41","slug":"exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/","title":{"rendered":"Explorando o Couchbase e o N1QL por meio do Touchbase usando Node.js e Angular.js - Parte 1: Criando um documento de usu\u00e1rio"},"content":{"rendered":"<h2>Parte 1: Registrar um usu\u00e1rio<\/h2>\n<h4>Materiais necess\u00e1rios<\/h4>\n<ul>\n<li>Node.js<\/li>\n<li>Express.js<\/li>\n<\/ul>\n<h4>M\u00f3dulos de n\u00f3 usados<\/h4>\n<ul>\n<li>Couchbase Node.js SDK\/N1QL<\/li>\n<li>analisador de corpo<\/li>\n<li>uuid<\/li>\n<li>node-forge<\/li>\n<\/ul>\n<p>A parte mais importante da cria\u00e7\u00e3o de uma rede social come\u00e7a com os usu\u00e1rios. Se voc\u00ea tiver apenas um diret\u00f3rio de pessoas, estar\u00e1 diante da forma mais b\u00e1sica de uma rede social, na qual as pessoas podem aprender umas sobre as outras. Dessa forma, a coisa mais importante que um usu\u00e1rio precisa ser capaz de fazer \u00e9 criar uma conta. Depois disso, o restante dos nossos desafios passa a ser manipular esse documento do usu\u00e1rio, ou pelo menos alguns aspectos dele. Antes de me aprofundar no assunto, deixe-me explicar a estrutura b\u00e1sica de arquivos que existe nesse aplicativo, o que ser\u00e1 fundamental para entender como o Touchbase funciona.<\/p>\n<h4>Estrutura do arquivo<\/h4>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #272822;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"> <span style=\"color: #f8f8f2\">app.js<\/span> <span style=\"color: #75715e\">\/\/cont\u00e9m nossa configura\u00e7\u00e3o b\u00e1sica para o aplicativo<\/span>\r\n <span style=\"color: #f8f8f2\">package.json<\/span> <span style=\"color: #75715e\">\/\/cont\u00e9m os m\u00f3dulos de n\u00f3 necess\u00e1rios para o aplicativo<\/span>\r\n <span style=\"color: #f8f8f2\">bower.json<\/span> <span style=\"color: #75715e\">\/\/ cont\u00e9m os componentes bower necess\u00e1rios para o aplicativo<\/span>\r\n <span style=\"color: #f8f8f2\">config.json<\/span> <span style=\"color: #75715e\">\/\/ cont\u00e9m as informa\u00e7\u00f5es de configura\u00e7\u00e3o necess\u00e1rias para o aplicativo<\/span>\r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">rotas<\/span> <span style=\"color: #75715e\">\/\/cont\u00e9m os pontos de extremidade da API para o n\u00f3 (onde os dados de back-end s\u00e3o recebidos)<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">rotas.js<\/span> \r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">modelos<\/span> <span style=\"color: #75715e\">\/\/cont\u00e9m todas as fun\u00e7\u00f5es para concluir as opera\u00e7\u00f5es de back-end, divididas por tipo<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">picturemodel.js<\/span> \r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">sessionmodel.js<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">statisticsmodel.js<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">usermodel.js<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">publishmodel.js<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">emailmodel.js<\/span>\r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">\u00edcones<\/span> <span style=\"color: #75715e\">\/\/cont\u00e9m todos os nossos \u00edcones<\/span>\r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">bower_components<\/span> <span style=\"color: #75715e\">\/\/onde todos os componentes do bower s\u00e3o salvos usando o bower install<\/span>\r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">m\u00f3dulos_n\u00f3<\/span> <span style=\"color: #75715e\">\/\/onde todos os m\u00f3dulos do n\u00f3 s\u00e3o armazenados usando o npm install<\/span>\r\n <span style=\"color: #f92672\">\/<\/span><span style=\"color: #f8f8f2\">p\u00fablico<\/span> <span style=\"color: #75715e\">\/\/onde todos os materiais de front-end s\u00e3o armazenados<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">js<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">html<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">index.html<\/span>\r\n  <span style=\"color: #f92672\">--<\/span><span style=\"color: #f8f8f2\">nav.html<\/span>\r\n<\/pre>\n<\/div>\n<p>Presumirei que voc\u00ea tenha um conhecimento geral dessa estrutura de arquivos, mas, se for muito novo, consulte o tutorial de Nic Raboy sobre como criar uma API de jogo com o Node.js e o Couchbase <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/making-a-game-api-server-using-nodejs-revisited\/\">aqui.<\/a><\/p>\n<p>Em nosso <strong>app.js<\/strong> teremos feito grande parte da configura\u00e7\u00e3o necess\u00e1ria. Para esta postagem, pedirei que voc\u00ea consulte primeiro <strong>rotas\/routes.js<\/strong>. Aqui voc\u00ea encontrar\u00e1 o <strong>'\/api\/registerUser'<\/strong> endpoint. Para quem est\u00e1 come\u00e7ando a usar o Node.js ou aplicativos baseados em API, um endpoint \u00e9 simplesmente o local em que uma chamada de API REST transmitir\u00e1 seus dados para o back-end. Por exemplo, se eu fizesse algum tipo de solicita\u00e7\u00e3o http POST no front-end para um endpoint chamado <strong>'\/api\/registerUser'<\/strong>Se eu enviar alguns dados do usu\u00e1rio para esse endpoint, ele executar\u00e1 as opera\u00e7\u00f5es necess\u00e1rias no back-end (criando um documento do usu\u00e1rio) antes de transmitir de volta alguma mensagem (normalmente, um objeto JSON).<\/p>\n<h4>API '\/api\/registerUser<\/h4>\n<p>Nesse caso, o <strong>\/api\/registerUser'<\/strong> receber\u00e1 um objeto JSON que conter\u00e1 o conte\u00fado de um formul\u00e1rio que o usu\u00e1rio preencheu para se registrar em nosso site, o Touchbase. No back-end, o Touchbase executa algumas valida\u00e7\u00f5es b\u00e1sicas para garantir que as informa\u00e7\u00f5es necess\u00e1rias do usu\u00e1rio tenham sido inseridas para essa conta, a fim de garantir que ela possa ser usada como uma conta leg\u00edtima. Primeiro, verificamos se o objeto tem atributos de nome, e-mail e senha. Todos eles tamb\u00e9m s\u00e3o verificados no front-end e exibem mensagens de erro; no entanto, nunca \u00e9 suficiente confiar na valida\u00e7\u00e3o do front-end. O javascript de front-end pode ser facilmente manipulado por um usu\u00e1rio final e pode expor falhas de seguran\u00e7a no aplicativo. Tendo isso em mente, a mesma valida\u00e7\u00e3o feita no front-end \u00e9 executada novamente no back-end. Certos campos s\u00e3o validados com express\u00f5es regulares. Por exemplo, para garantir que a senha seja forte o suficiente. Em seguida, a senha \u00e9 comparada com a senha de confirma\u00e7\u00e3o para garantir que sejam id\u00eanticas. O e-mail tamb\u00e9m \u00e9 verificado para garantir que ainda n\u00e3o tenha sido usado antes de usar o <strong>Usu\u00e1rio.advancedSearch<\/strong> (essa fun\u00e7\u00e3o ser\u00e1 explicada detalhadamente em breve). Se todas essas condi\u00e7\u00f5es forem atendidas, a fun\u00e7\u00e3o <strong>Usu\u00e1rio.create<\/strong> \u00e9 executada.<\/p>\n<p>Para ver o <strong>'User.create'<\/strong> fun\u00e7\u00e3o, v\u00e1 para <strong>models\/usermodel.js<\/strong>ou veja o snippet abaixo. Nesse arquivo, voc\u00ea ver\u00e1 uma fun\u00e7\u00e3o chamada <strong>'User.create'<\/strong>. Essa fun\u00e7\u00e3o \u00e9 usada para gerar um documento JSON que descreve diferentes aspectos do usu\u00e1rio. Como voc\u00ea pode notar, alguns desses aspectos v\u00eam diretamente da entrada do usu\u00e1rio, que foi passada para a fun\u00e7\u00e3o <strong>'User.create'<\/strong> fun\u00e7\u00e3o como <strong>'params'<\/strong>enquanto outros s\u00e3o gerados na cria\u00e7\u00e3o do documento sem nenhuma entrada do usu\u00e1rio. Por exemplo, um UUID (identificador universalmente exclusivo) aleat\u00f3rio \u00e9 criado como o ID do documento do usu\u00e1rio; saiba mais sobre UUIDs <a href=\"https:\/\/searchsoa.techtarget.com\/definition\/UUID\">aqui<\/a>. Para isso, usei o <a href=\"https:\/\/github.com\/defunctzombie\/node-uuid\">m\u00f3dulo de n\u00f3 uuid<\/a>. Esse ID de documento (UUID) deve ser uma forma exclusiva de identificar o usu\u00e1rio para todos os fins futuros. Como queremos ter certeza de que cada documento \u00e9 totalmente exclusivo, usamos um UUID e, como queremos garantir que o documento seja o mais flex\u00edvel poss\u00edvel, evitamos usar qualquer atributo de uso espec\u00edfico como ID do documento. No futuro, pesquisaremos esses usu\u00e1rios principalmente por atributo e raramente usaremos diretamente esses UUIDs, a menos que saibamos que estamos pesquisando um usu\u00e1rio espec\u00edfico.<\/p>\n<p>Tamb\u00e9m queremos manter a hora em que o documento do usu\u00e1rio foi gerado e analisar os logins ao longo do tempo, por isso usamos a hora atual, que geramos usando JavaScript, e depois inserimos isso em nosso objeto aninhado 'timeTracker'. Voc\u00ea pode notar que essas vari\u00e1veis tamb\u00e9m s\u00e3o divididas de forma estranha por stringAttributes, dropdownAttributes e arrayAttributes. A raz\u00e3o para isso se deve principalmente \u00e0 forma como consultaremos esses atributos usando a linguagem de consulta N1QL do Couchbase. Isso \u00e9 explicado detalhadamente em <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/touchbase-part-0-creating-a-data-model\/\">parte 0<\/a> da s\u00e9rie do blog, mas, em ess\u00eancia, o motivo pelo qual ele \u00e9 estruturado dessa forma \u00e9 permitir que o c\u00f3digo seja alterado muito pouco para ser reutilizado. No login, voc\u00ea tamb\u00e9m ver\u00e1 o atributo \"password\", que \u00e9 uma vers\u00e3o com hash da senha que o usu\u00e1rio digitou. Isso \u00e9 feito usando <a href=\"https:\/\/github.com\/digitalbazaar\/forge\">node-forge<\/a>.<\/p>\n<h4>Fun\u00e7\u00e3o 'User.create' (Usu\u00e1rio.criar)<\/h4>\n<p>Agora usamos uma instru\u00e7\u00e3o de inser\u00e7\u00e3o N1QL para criar o documento. Em caso de erro, voc\u00ea ver\u00e1 que uma fun\u00e7\u00e3o de retorno de chamada \u00e9 chamada. Voc\u00ea notar\u00e1 que h\u00e1 um retorno de chamada passado como par\u00e2metro, que \u00e9 a fun\u00e7\u00e3o <strong>'function(error, result)'<\/strong> que voc\u00ea v\u00ea no <strong>rotas\/routes.js<\/strong> arquivo. Isso \u00e9 usado para evitar a necessidade de escrever repetidamente a mesma sintaxe para lidar com sucesso e erros. Se a inser\u00e7\u00e3o for bem-sucedida (o resultado que deve ocorrer), o resultado ser\u00e1 passado de volta para o arquivo <strong>rotas\/routes.js<\/strong> fun\u00e7\u00e3o para <strong>'\/api\/registerUser'<\/strong>e ele continuar\u00e1 a ser usado para a\u00e7\u00f5es futuras. Depois disso, vemos que isso \u00e9 passado para <strong>'Session.makeVerification'<\/strong>.<\/p>\n<h4>Consulta N1QL \"User Insert\" (inser\u00e7\u00e3o de usu\u00e1rio)<\/h4>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #272822;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #66d9ef\">INSERIR<\/span> <span style=\"color: #66d9ef\">PARA<\/span>  <span style=\"color: #f8f8f2\">usu\u00e1rios<\/span> <span style=\"color: #f8f8f2\">(<\/span><span style=\"color: #66d9ef\">CHAVE<\/span><span style=\"color: #f8f8f2\">,<\/span> <span style=\"color: #f8f8f2\">VALUE)<\/span> <span style=\"color: #66d9ef\">VALORES<\/span> <span style=\"color: #f8f8f2\">(<\/span><span style=\"color: #ae81ff\">$1<\/span><span style=\"color: #f8f8f2\">,<\/span> <span style=\"color: #ae81ff\">$2<\/span><span style=\"color: #f8f8f2\">);<\/span>\r\n<\/pre>\n<\/div>\n<p>As informa\u00e7\u00f5es que geramos em nosso \u00faltimo resultado foram criadas na forma de um objeto JSON que continha nosso ID de usu\u00e1rio e o documento do usu\u00e1rio, que foram gerados com o comando <strong>'User.create'<\/strong> fun\u00e7\u00e3o. Para ver um exemplo do documento que seria inserido, veja <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/touchbase-part-0-creating-a-data-model\/\">parte 0<\/a>. Essas informa\u00e7\u00f5es s\u00e3o usadas para <strong>'Session.makeVerification'<\/strong> para gerar um e-mail que \u00e9 usado para verificar o endere\u00e7o de e-mail do usu\u00e1rio. Caso contr\u00e1rio, o usu\u00e1rio n\u00e3o poder\u00e1 acessar sua conta.<\/p>\n<p>Se voc\u00ea quiser realizar essa etapa extra de verifica\u00e7\u00e3o em suas contas, isso ser\u00e1 discutido na pr\u00f3xima publica\u00e7\u00e3o, parte 2, sobre verifica\u00e7\u00e3o de e-mail com o Couchbase, o Nodemailer e a API Sengrid.<\/p>\n<p>Obrigado a todos por seu tempo e espero que tenha sido \u00fatil. Fa\u00e7a um coment\u00e1rio abaixo com suas d\u00favidas, coment\u00e1rios ou cr\u00edticas.<\/p>","protected":false},"excerpt":{"rendered":"<p>Part 1: Register a User Necessary Materials Node.js Express.js Node Modules used Couchbase Node.js SDK\/N1QL body-parser uuid node-forge The most important part of building a social network begins with the users. If you just have a directory of people, you [&hellip;]<\/p>","protected":false},"author":60,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[9034],"class_list":["post-1991","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Understanding how Touchbase operates - 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\/pt\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document\" \/>\n<meta property=\"og:description\" content=\"Part 1: Register a User Necessary Materials Node.js Express.js Node Modules used Couchbase Node.js SDK\/N1QL body-parser uuid node-forge The most important part of building a social network begins with the users. If you just have a directory of people, you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-21T17:34:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-27T14:24:41+00:00\" \/>\n<meta name=\"author\" content=\"Pranav Mayuram\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pranav Mayuram\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\"},\"author\":{\"name\":\"Pranav Mayuram\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/454261061bad5159ad2696e0bf162eaa\"},\"headline\":\"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document\",\"datePublished\":\"2015-10-21T17:34:07+00:00\",\"dateModified\":\"2023-06-27T14:24:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\"},\"wordCount\":1111,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\",\"name\":\"Understanding how Touchbase operates - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2015-10-21T17:34:07+00:00\",\"dateModified\":\"2023-06-27T14:24:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document\"}]},{\"@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\/454261061bad5159ad2696e0bf162eaa\",\"name\":\"Pranav Mayuram\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/61baa4ff0f18aa9a8ce672f0f97f1ac0\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/de8b1b457fdc2f5f8b407ef8bf0bfcacb1e2be0ab9de2cee8e8aa4ee7f985709?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/de8b1b457fdc2f5f8b407ef8bf0bfcacb1e2be0ab9de2cee8e8aa4ee7f985709?s=96&d=mm&r=g\",\"caption\":\"Pranav Mayuram\"},\"description\":\"Pranav Mayuram is a N1QL Query language intern, Couchbase. Built a social network platform, Touchbase, using Couchbase Server, Node.js, Express &amp; Angular.js.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/pranav-mayuram\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Understanding how Touchbase operates - 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\/pt\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/","og_locale":"pt_BR","og_type":"article","og_title":"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document","og_description":"Part 1: Register a User Necessary Materials Node.js Express.js Node Modules used Couchbase Node.js SDK\/N1QL body-parser uuid node-forge The most important part of building a social network begins with the users. If you just have a directory of people, you [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/","og_site_name":"The Couchbase Blog","article_published_time":"2015-10-21T17:34:07+00:00","article_modified_time":"2023-06-27T14:24:41+00:00","author":"Pranav Mayuram","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pranav Mayuram","Est. reading time":"6 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/"},"author":{"name":"Pranav Mayuram","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/454261061bad5159ad2696e0bf162eaa"},"headline":"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document","datePublished":"2015-10-21T17:34:07+00:00","dateModified":"2023-06-27T14:24:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/"},"wordCount":1111,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Uncategorized"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/","url":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/","name":"Understanding how Touchbase operates - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2015-10-21T17:34:07+00:00","dateModified":"2023-06-27T14:24:41+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/exploring-couchbase-and-n1ql-through-touchbase-using-node-js-and-angular-js-part-1-creating-a-user-document\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Exploring Couchbase and N1QL through Touchbase using Node.js and Angular.js \u2013 Part 1: Creating a User Document"}]},{"@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\/454261061bad5159ad2696e0bf162eaa","name":"Pranav Mayuram","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/61baa4ff0f18aa9a8ce672f0f97f1ac0","url":"https:\/\/secure.gravatar.com\/avatar\/de8b1b457fdc2f5f8b407ef8bf0bfcacb1e2be0ab9de2cee8e8aa4ee7f985709?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/de8b1b457fdc2f5f8b407ef8bf0bfcacb1e2be0ab9de2cee8e8aa4ee7f985709?s=96&d=mm&r=g","caption":"Pranav Mayuram"},"description":"Pranav Mayuram \u00e9 estagi\u00e1rio da linguagem de consulta N1QL, Couchbase. Criou uma plataforma de rede social, Touchbase, usando o Couchbase Server, Node.js, Express e Angular.js.","url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/pranav-mayuram\/"}]}},"authors":[{"term_id":9034,"user_id":60,"is_guest":0,"slug":"pranav-mayuram","display_name":"Pranav Mayuram","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/de8b1b457fdc2f5f8b407ef8bf0bfcacb1e2be0ab9de2cee8e8aa4ee7f985709?s=96&d=mm&r=g","author_category":"","last_name":"Mayuram","first_name":"Pranav","job_title":"","user_url":"","description":"Pranav Mayuram \u00e9 estagi\u00e1rio da linguagem de consulta N1QL, Couchbase. Criou uma plataforma de rede social, Touchbase, usando o Couchbase Server, Node.js, Express e Angular.js."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1991","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\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=1991"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1991\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=1991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=1991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=1991"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=1991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}