

{"id":13711,"date":"2018-04-23T09:13:55","date_gmt":"2018-04-23T09:13:55","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=13711"},"modified":"2021-05-09T13:07:33","modified_gmt":"2021-05-09T07:37:33","slug":"mongodb-environment-setup","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/","title":{"rendered":"MongoDB Environment Setup | Install MongoDB on Windows"},"content":{"rendered":"<p>In previous MongoDB Tutorial, we discussed\u00a0the <strong>advantages and limitations of MongoDB<\/strong>. In this MongoDB Environment setup Tutorial, we will see how to set up the environment for MongoDB on your Windows OS. Also, we will learn how to install MongoDB.<\/p>\n<p>So, let&#8217;s the MongoDB Environment Setup\/Install MongoDB.<\/p>\n<div id=\"attachment_13736\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13736\" class=\"wp-image-13736 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB on Windows\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-13736\" class=\"wp-caption-text\">MongoDB Environment Setup | Install MongoDB on Windows<\/p><\/div>\n<h2>Steps for MongoDB Environment Setup on Windows<\/h2>\n<p>MongoDB Environment Setup is very easy for Windows OS. To do environment setup, you will have to follow few simple steps.<\/p>\n<ol>\n<li>Know your Windows architecture<\/li>\n<li>Download MongoDB setup file<\/li>\n<li>Install MongoDB setup<\/li>\n<li>Set up MongoDB Environment<\/li>\n<li>Connect to the MongoDB server<\/li>\n<li>MongoDB as a Windows service<\/li>\n<li>Create configuration file<\/li>\n<li>Run MongoDB Environment setup<\/li>\n<\/ol>\n<h3>a. Know your Windows Architecture<\/h3>\n<p>Before downloading MongoDB setup, you must know which Windows version you are using. To know about your system architecture, open the command prompt and execute some commands given below.<\/p>\n<div id=\"attachment_13721\" style=\"width: 447px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/cmd.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13721\" class=\"wp-image-13721 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/cmd.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"437\" height=\"160\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/cmd.jpg 437w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/cmd-150x55.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/cmd-300x110.jpg 300w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/a><p id=\"caption-attachment-13721\" class=\"wp-caption-text\">Image.1 MongoDB Environment Setup &#8211;\u00a0Know your Windows Architecture<\/p><\/div>\n<p>After executing these commands, you will know if your system is running on 32-bit or 64-bit architecture. Then you have to download the MongoDB setup accordingly.<\/p>\n<h3>b. Download MongoDB Setup File<\/h3>\n<p>After knowing the architecture, you have to download the latest version of MongoDB from the official website.<\/p>\n<div id=\"attachment_14508\" style=\"width: 1376px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-14508\" class=\"wp-image-14508 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1.jpg\" alt=\"MongoDB Environment Setup\" width=\"1366\" height=\"702\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1.jpg 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1-150x77.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1-300x154.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1-768x395.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Capture-2-1-1024x526.jpg 1024w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><p id=\"caption-attachment-14508\" class=\"wp-caption-text\">Image.2 MongoDB Environment Setup &#8211; Download MongoDB Setup File<\/p><\/div>\n<p>You can follow this link to download from community server of MongoDB.<\/p>\n<p><a href=\"https:\/\/www.mongodb.org\/downloads\">ttps:\/\/www.mongodb.org\/downloads<\/a><\/p>\n<p>Download the MSI file from this server.<\/p>\n<div id=\"attachment_13723\" style=\"width: 448px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/INSTALLATION-PACKAGE.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13723\" class=\"wp-image-13723 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/INSTALLATION-PACKAGE.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"438\" height=\"208\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/INSTALLATION-PACKAGE.jpg 438w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/INSTALLATION-PACKAGE-150x71.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/INSTALLATION-PACKAGE-300x142.jpg 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/a><p id=\"caption-attachment-13723\" class=\"wp-caption-text\">Image 3. Download MongoDB Setup File<\/p><\/div>\n<h3>c. Install MongoDB Setup<\/h3>\n<p>To install MongoDB setup, you need to run the file as administrator. After doing that you need to follow the setup guide that appears in the installation process.<\/p>\n<div id=\"attachment_13725\" style=\"width: 502px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-47-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13725\" class=\"wp-image-13725 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-47-1.png\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"492\" height=\"383\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-47-1.png 492w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-47-1-150x117.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-47-1-300x234.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/a><p id=\"caption-attachment-13725\" class=\"wp-caption-text\">Image. 4 MongoDB Environment Setup &#8211; Install MongoDB Setup<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_13726\" style=\"width: 501px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-36-2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13726\" class=\"wp-image-13726 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-36-2.png\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"491\" height=\"389\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-36-2.png 491w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-36-2-150x119.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-36-2-300x238.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><p id=\"caption-attachment-13726\" class=\"wp-caption-text\">Image. 5 MongoDB Environment Setup &#8211;\u00a0Install MongoDB Setup<\/p><\/div>\n<p>You can choose a custom directory for the MongoDB data and log files. Otherwise, by default, it will install MongoDB to C:\\Program Files\\MongoDB\\Server\\3.6\\.<\/p>\n<p>MongoDB does not have any system dependency, so it is not problematic to choose any folder in the directory. You can choose any directory in the system.<\/p>\n<div id=\"attachment_13727\" style=\"width: 503px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-38.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13727\" class=\"wp-image-13727 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-38.png\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"493\" height=\"378\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-38.png 493w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-38-150x115.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-38-300x230.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/a><p id=\"caption-attachment-13727\" class=\"wp-caption-text\">Image. 6 MongoDB Environment Setup &#8211;\u00a0Install MongoDB Setup<\/p><\/div>\n<p>You will see the option to install MongoDB compass in addition to MongoDB serve and you can check the box if you want it to install MongoDB. If not, leave it blank.<\/p>\n<div id=\"attachment_13728\" style=\"width: 502px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-39-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13728\" class=\"wp-image-13728 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-39-1.png\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"492\" height=\"386\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-39-1.png 492w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-39-1-150x118.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-39-1-300x235.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/a><p id=\"caption-attachment-13728\" class=\"wp-caption-text\">Image. 7 MongoDB Environment Setup &#8211;\u00a0Install MongoDB Setup<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_13729\" style=\"width: 499px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-40-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13729\" class=\"wp-image-13729 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-40-1.png\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"489\" height=\"385\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-40-1.png 489w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-40-1-150x118.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Screenshot-40-1-300x236.png 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/a><p id=\"caption-attachment-13729\" class=\"wp-caption-text\">Image. 8 MongoDB Environment Setup &#8211; Install MongoDB Setup<\/p><\/div>\n<h3>d.\u00a0MongoDB Environment Setup<\/h3>\n<p>All of MongoDB data is stored in a specified data directory. You need to create it manually in the MongoDB Folder on the C drive. For this, run the following command at the command prompt.<\/p>\n<p><em>\u00a0md \\data\\db<\/em><em>\u00a0<\/em><\/p>\n<p>You can install MongoDB at any location of your choice.<em>\u00a0<\/em><\/p>\n<div id=\"attachment_13730\" style=\"width: 415px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/path.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13730\" class=\"wp-image-13730 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/path.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"405\" height=\"138\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/path.jpg 405w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/path-150x51.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/path-300x102.jpg 300w\" sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/a><p id=\"caption-attachment-13730\" class=\"wp-caption-text\">Image. 9 MongoDB Environment Setup<\/p><\/div>\n<h3>e. Start MongoDB<\/h3>\n<p>To start MongoDB you need to execute this command. This will start the main MongoDB process. You will see at the bottom of the command prompt a message as &#8220;waiting for a connection\u201d. This means that the process has started successfully.<\/p>\n<p><em>&#8220;C:\\Program Files\\MongoDB\\Server\\3.6\\bin\\mongod.exe&#8221;<\/em><\/p>\n<div id=\"attachment_13731\" style=\"width: 806px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13731\" class=\"wp-image-13731 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"796\" height=\"463\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2.jpg 796w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2-150x87.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2-300x174.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/pathh2-768x447.jpg 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/a><p id=\"caption-attachment-13731\" class=\"wp-caption-text\">Image. 10 MongoDB Environment Setup &#8211;\u00a0Start MongoDB<\/p><\/div>\n<h3>f. Connect to MongoDB Server<\/h3>\n<p>After executing the MongoDB.exe file, the process has begun. Now we need to connect it to the MongoDB server. We will connect it through Mongo.exe shell by opening another command prompt. Now you need to execute a command to connect with the shell.<em>\u00a0<\/em><\/p>\n<p><em>&#8220;C:\\Program Files\\MongoDB\\Server\\3.6\\bin\\mongo.exe&#8221;<\/em><\/p>\n<p>Now MongoDB is ready to use. You can terminate the running Process of MongoDB by pressing \u201cctrl+c\u201d.<\/p>\n<div id=\"attachment_13732\" style=\"width: 991px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13732\" class=\"wp-image-13732 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"981\" height=\"515\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell.jpg 981w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/ongoDBSHell-768x403.jpg 768w\" sizes=\"auto, (max-width: 981px) 100vw, 981px\" \/><\/a><p id=\"caption-attachment-13732\" class=\"wp-caption-text\">Image 11. MongoDB Environment Setup &#8211; Connect to MongoDB Server<\/p><\/div>\n<h3>g. MongoDB as a Windows Service<\/h3>\n<p>Now you need to create some directories using command prompt &amp; executing the following commands:<\/p>\n<p><em>mkdir c:\\data\\db<\/em><\/p>\n<p><em>mkdir c:\\data\\log<\/em><em>\u00a0<\/em><\/p>\n<p>Also, you can directly create new folders on the c drive. First, create a folder and name it \u201cdata\u201d then create two folders as \u201cdb\u201d and \u201clog\u201d inside the data folder. All of your database and the log files will be stored in these two folders.<\/p>\n<div id=\"attachment_13733\" style=\"width: 806px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13733\" class=\"wp-image-13733 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog.jpg\" alt=\"MongoDB Environment Setup | Install MongoDB\" width=\"796\" height=\"191\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog.jpg 796w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog-150x36.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog-300x72.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/datalog-768x184.jpg 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/a><p id=\"caption-attachment-13733\" class=\"wp-caption-text\">Image 11. MongoDB Environment Setup &#8211; MongoDB as a Windows Service<\/p><\/div>\n<h3>h. Create a MongoDB Configuration File<\/h3>\n<p>After creating directories, you need to create a configuration file. The file must specify both the systemLog.path and storage.dbPath. Otherwise, an error will be shown on the display and service will not be able to start.<\/p>\n<p><em>systemLog:<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 destination: file<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 path: c:\\data\\log\\mongod.log<\/em><br \/>\n<em>storage:<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 dbPath: c:\\data\\db<\/em><em>\u00a0<\/em><\/p>\n<h3>i.\u00a0 Create the MongoDB Service<\/h3>\n<p>You need to execute this command for creating the MongoDB service<\/p>\n<p><em>sc.exe create MongoDB binPath= &#8220;\\&#8221;C:\\Program Files\\MongoDB\\Server\\3.6\\bin\\mongod.exe\\&#8221; &#8211;service &#8211;config=\\&#8221;C:\\Program Files\\MongoDB\\Server\\3.6\\mongod.cfg\\&#8221;&#8221; DisplayName= &#8220;MongoDB&#8221; start= &#8220;auto&#8221;<\/em><em>\u00a0<\/em><\/p>\n<p>If the service is successfully created the following message will display<em>\u00a0<\/em><\/p>\n<p><em>[SC] CreateService SUCCESS<\/em><em>\u00a0<\/em><\/p>\n<h3>j. Start the MongoDB Service<\/h3>\n<p>If you want to start the service, you have to write a single sentence in a command prompt.<br \/>\n<em>net start MongoDB.<\/em><\/p>\n<h3>k. Stop the Service<\/h3>\n<p>Similarly, to stop the service you have to execute the following command.<br \/>\nnet stop MongoDB<\/p>\n<h3>l. Remove the Service<\/h3>\n<p><em>You can delete the service whenever you want by executing this simple code.<\/em><em>\u00a0<\/em><br \/>\n<em>net stop MongoDB<\/em><em>\u00a0<\/em><br \/>\nThis will first stop the service then delete it from the system.<\/p>\n<p>This was all\u00a0about MongoDB Environmental Setup Tutorial. Hope you like our explanation of How to Install MongoDB on Windows 10.<\/p>\n<h2>Conclusion<\/h2>\n<p>Hence, we saw MongoDB Environment Setup. Also, we learn how to run it as a Windows service. It was all about downloading the setup and writing some code lines in the command prompt. Furthermore, if you have any query, feel free to ask in a comment section.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1963,&quot;href&quot;:&quot;https:\\\/\\\/www.mongodb.org\\\/downloads&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20160505122301\\\/https:\\\/\\\/www.mongodb.org\\\/downloads&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 14:15:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-14 00:53:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-01 11:17:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 07:57:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-29 14:42:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 13:42:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-12 11:40:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-04 22:49:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-22 11:27:42&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-22 11:27:42&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In previous MongoDB Tutorial, we discussed\u00a0the advantages and limitations of MongoDB. In this MongoDB Environment setup Tutorial, we will see how to set up the environment for MongoDB on your Windows OS. Also, we&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":13736,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[2895,3099,6779,8821,8829,11519,13745,13747,13859],"class_list":["post-13711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mongodb","tag-connect-to-mongodb-server","tag-create-the-mongodb-service","tag-install-mongodb","tag-mongodb-environment-setup","tag-mongodb-install","tag-remove-the-service","tag-start-mongodb","tag-start-the-mongodb-service","tag-stop-the-service"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MongoDB Environment Setup | Install MongoDB on Windows - DataFlair<\/title>\n<meta name=\"description\" content=\"MongoDB Environment Setup Tutorial - How to Install MongoDB on Windows 10\/7, Download MongoDB Setup, Setup MongoDB Environment, Connect to MongoDB Server\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MongoDB Environment Setup | Install MongoDB on Windows - DataFlair\" \/>\n<meta property=\"og:description\" content=\"MongoDB Environment Setup Tutorial - How to Install MongoDB on Windows 10\/7, Download MongoDB Setup, Setup MongoDB Environment, Connect to MongoDB Server\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-23T09:13:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-09T07:37:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MongoDB Environment Setup | Install MongoDB on Windows - DataFlair","description":"MongoDB Environment Setup Tutorial - How to Install MongoDB on Windows 10\/7, Download MongoDB Setup, Setup MongoDB Environment, Connect to MongoDB Server","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:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/","og_locale":"en_US","og_type":"article","og_title":"MongoDB Environment Setup | Install MongoDB on Windows - DataFlair","og_description":"MongoDB Environment Setup Tutorial - How to Install MongoDB on Windows 10\/7, Download MongoDB Setup, Setup MongoDB Environment, Connect to MongoDB Server","og_url":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-04-23T09:13:55+00:00","article_modified_time":"2021-05-09T07:37:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"MongoDB Environment Setup | Install MongoDB on Windows","datePublished":"2018-04-23T09:13:55+00:00","dateModified":"2021-05-09T07:37:33+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/"},"wordCount":1047,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg","keywords":["Connect to MongoDB Server","Create the MongoDB Service","Install MongoDb","MongoDB Environment Setup","MongoDB inStall","Remove the Service","Start MongoDB","Start the MongoDB Service","Stop the Service"],"articleSection":["MongoDB Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/","url":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/","name":"MongoDB Environment Setup | Install MongoDB on Windows - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg","datePublished":"2018-04-23T09:13:55+00:00","dateModified":"2021-05-09T07:37:33+00:00","description":"MongoDB Environment Setup Tutorial - How to Install MongoDB on Windows 10\/7, Download MongoDB Setup, Setup MongoDB Environment, Connect to MongoDB Server","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Environment-Setup-mongodb-01.jpg","width":1200,"height":628,"caption":"MongoDB Environment Setup | Install MongoDB on Windows"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/mongodb-environment-setup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"MongoDB Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/mongodb\/"},{"@type":"ListItem","position":3,"name":"MongoDB Environment Setup | Install MongoDB on Windows"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=13711"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13711\/revisions"}],"predecessor-version":[{"id":93191,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13711\/revisions\/93191"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/13736"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=13711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=13711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=13711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}