{"id":995,"date":"2017-01-01T15:50:16","date_gmt":"2017-01-01T18:50:16","guid":{"rendered":"https:\/\/www.semeru.com.br\/blog\/?p=995"},"modified":"2022-12-21T13:47:00","modified_gmt":"2022-12-21T16:47:00","slug":"instalando-o-mongodb","status":"publish","type":"post","link":"https:\/\/www.semeru.com.br\/blog\/instalando-o-mongodb\/","title":{"rendered":"Instalando o MongoDB"},"content":{"rendered":"<p>Nesse post iremos aprender a instalar o MongoDB. Um banco de dados n\u00e3o relacional ou NoSQL como s\u00e3o mais comumente conhecidos. Para isso precisamos efetuar o download do MongoDB no <a href=\"https:\/\/www.mongodb.com\/download-center#community\">site site oficial<\/a>. Temos duas op\u00e7\u00f5es baixar o instalador sugerido para a nossa plataforma, no meu caso um .msi para o Windows. Ou escolher entre as diferentes vers\u00f5es dispon\u00edveis clinando no link <em>&#8220;All Versions Binaries&#8221;<\/em> destacado em vermelho na imagem.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo01.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Caso a sua escolha seja a segunda op\u00e7\u00e3o voc\u00ea ir\u00e1 visualizar uma imagem similar a imagem abaixo. Nesse caso escolha o instalador que mais se adeque a sua necessidade. No meu caso o arquivo .zip destacado na imagem abaixo.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo02.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Ap\u00f3s efetuar o dounload extraia seu conteudo para o local de sua prefer\u00eancia.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo03.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>No meu caso a unidade C:\/\/.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo04.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Se preferir renomeie o diret\u00f3rio para um nome mais amig\u00e1vel.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo05.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Acesse a pasta e copie o endere\u00e7o da instala\u00e7\u00e3o no meu caso <em>&#8220;C:\\mongodb\\bin&#8221;<\/em>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo06.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Caso tenha escolhido a op\u00e7\u00e3o de baixar o bin\u00e1rio .msi acesse o diret\u00f3rio de downloads e execute o instalador.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo07.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Na janela inicial clique em next.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo08.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Clique no checkbox de aceite dos termos e em seguida clique em <em>&#8220;Next&#8221;<\/em>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo09.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Clique no bot\u00e3o <em>Complete<\/em> e em seguida em <em>Next<\/em><\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo10.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Clique no bot\u00e3o <em>Install<\/em><\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo11.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Por fim clique em <em>Finish<\/em>. Pronto voc\u00ea j\u00e1 sabe executar a instala\u00e7\u00e3o por arquivo zip ou por instalador compilado. Agora vamos fazer as configura\u00e7\u00f5es finais.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo12.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Acesse a raiz da unidade C:\\\\ e crie uma nova pasta chamada <em>data<\/em>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo13.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Dentro da pasta data crie outra pasta chamada <em>db<\/em>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo14.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Casdo se esque\u00e7a de executar a etapa anterior ao iniciar o MongoDB ver\u00e1 o seguinte erro.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo15.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Agora vamos adicionar as vari\u00e1veis de ambiente do MongoDB. Para isto, no Windows Explorer, clique com o direito sobre \u00edcone <em>&#8220;Este computador&#8221;<\/em> e clique em propriedades.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo16.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Se preferir acesse o menu iniciar e clique em configura\u00e7\u00f5es.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo17.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Digite <em>&#8220;Configura\u00e7\u00f5es Avan\u00e7adas&#8221;<\/em> e selecione a op\u00e7\u00e3o <em>&#8220;Exibir configura\u00e7\u00f5es avan\u00e7adas do sistema&#8221;<\/em>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo18.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Dos dois modos chegaremos a tela abaixo clique no menu &#8220;Configura\u00e7\u00f5es avan\u00e7adas do sistema&#8221;.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo19.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Na tela que se abre clique no bot\u00e3o &#8220;Vari\u00e1veis de Ambiente&#8221; destacado em vermelho.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo20.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Nas vari\u00e1veis do sistema selecione a vari\u00e1vel <em>Path<\/em> e clique no bot\u00e3o <em>Editar<\/em> destacados em vermelho.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo21.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Clique em novo e cole o diret\u00f3rio em que se encontra a instala\u00e7\u00e3o do <strong>MongoDB<\/strong> que pode ser o endere\u00e7o do zip que compiamos anteriormente ou o diret\u00f3rio dos arquivos de programas se voc\u00ea tiver usado o instalador.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo22.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Acesse um terminal e digite o comando <em><strong>mongod<\/strong><\/em> voc\u00ea dever\u00e1 visualizar uma tela similar a imagem abaixo dizendo que o <strong>MongoDB<\/strong> pode ser acessado pela porta <strong>27017<\/strong>.<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/github.com\/leandrocgsi\/spring-boot-rest-with-mongodb-example\/blob\/master\/img_mongodb\/mongo23.png?raw=true\" alt=\"Downloading Installer\" \/><\/p>\n<p>Pronto voc\u00ea instalou com sucesso o MongoDB na sua m\u00e1quina agora voc\u00ea pode se conectar a ele usando uma ferramenta como o &#8220;MongoVUE&#8221; ou &#8220;RoboMongo&#8221;. No pr\u00f3ximo post aprenderemos como definir o como como um servi\u00e7o que inicializa autom\u00e1ticamente com o Windows.<\/p>\n<h2>Treinamentos relacionados com este post<\/h2>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_react_java\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"React JS consumindo REST API RESTful em Spring Boot Java 16\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/16-rest-react-java.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_react_asp_net\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"React JS consumindo REST API RESTful em ASP.NET Core .NET 6\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/17-rest-react-aspnet.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_react_kotlin\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"React JS consumindo REST API RESTful em Spring Boot e Kotlin\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/19-rest-react-kotlin.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_docker\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Docker do 0 \u00e0 Maestria: Cont\u00eaineres Desmistificados mais 3 B\u00d4NUS\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/09-docker.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_kotlin\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Kotlin para DEVs Java: Aprenda a Linguagem Padr\u00e3o do Android\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/20-kotlin.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_java\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0  AWS com Spring Boot 3, Java e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/07-rest-spring-java.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_asp_net\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0 Azure com ASP.NET Core 5 e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/01-rest-asp.png\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_kotlin\" target=\"_blank\" rel=\"noopener\"> <img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0 AWS com Spring Boot 3, Kotlin e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/18-rest-spring-kotlin.png\" \/><br \/>\n<\/a><\/p>\n<div align=\"right\"><div class=\"sharexyWidgetNoindexUniqueClassName\"><div id=\"shr_17070909\"><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Nesse post iremos aprender a instalar o MongoDB. Um banco de dados n\u00e3o relacional ou NoSQL como s\u00e3o mais comumente conhecidos. Para isso precisamos efetuar o download do MongoDB no site site oficial. Temos duas op\u00e7\u00f5es baixar o instalador sugerido para a nossa plataforma, no meu caso um .msi para o Windows. Ou escolher entre [&#8230;]<\/p>\n<div align=\"right\">\n<div class=\"sharexyWidgetNoindexUniqueClassName\">\n<div id=\"shr_17070909\"><\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[242,241],"tags":[244,243],"_links":{"self":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/995"}],"collection":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/comments?post=995"}],"version-history":[{"count":12,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/995\/revisions"}],"predecessor-version":[{"id":1571,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/995\/revisions\/1571"}],"wp:attachment":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/media?parent=995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/categories?post=995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/tags?post=995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}