How to install MongoDB for development in Windows
Posted on July 2nd 2018 by ZarkoHow to install MongoDB for development in Windows
2. MongoDB setup
VIDEO TUTORIAL NOW AVAILABLE! https://www.youtube.com/watch?v=MCpbfYvvoPY
Be sure to visit my new YouTube channel linked below! Also, if you found the tutorial useful please take a second to like the video and subscribe for more content in the future!
Visit the MongoDB Download Center by clicking on the following link: https://www.mongodb.com/download-center
Select the ‘Community Server’ option, make sure Windows is selected as your operating system and click the download button.
After the download finishes, run the MongoDB .msi installation file (press ‘Run’ when the Window security dialog pops up)
2) Tick the ‘I accept the terms in the License Agreement’ checkbox (after reading the license agreement carefully, of course)
9) Finally, click the ‘Install’ button (Press ‘Yes’ on the User Account Control dialog from Windows)
Post-install Configuration
11) First thing we will do is create the data folder for MongoDB.
Start Windows Powershell (press the Windows Start button and type ‘powershell’ to find the shortcut) and type the following command:
New-Item -ItemType directory -Path C:\data\db
Alternatively, you can manually create these folder by going into your C:\ drive with the file explorer, then create a new folder called ‘data’
Go into the newly created folder called ‘data’ and create a new folder inside of it, called ‘db’
12) To easily start our mongod server and mongo terminal, we will create a Windows batch script file (.bat) which will serve as a shortcut for us.
Open a new file in your code editor and paste in the following:
@echo off
cd "C:\mongodb\bin"
start mongod.exe
timeout 4
start mongo.exe
exit
Then, press Save (Ctrl+S), navigate to your desktop and save the file as ‘StartMongo.bat’
13) Now you will be able to start your mongod database server and the mongo terminal by double-clicking the StartMongo.bat file on your Desktop!