Install MongoDB On Windows
Overview
This tutorial will walk you through the steps for installing MongoDB on Windows.
- Download the MongoDB from here, select MSI and platform as Windows and click on Download.
- It will download 'mongodb-windows-x86_64-4.4.6-signed.msi', double click on it and click 'Next' to start the setup the MongoDB.
- Accept the terms and licence agreement then click Next.
- Select Complete setup as given below:
- Select "Run service as Network Service user" and copy Data Directory path for future reference.
- Uncheck Mongo Compass checkbox, and Select Next.
- Click Install to start installation.
- Click Finish to complete the setup.
Test the MongoDB through Command line
- Go to "C:\Program Files\MongoDB\Server\4.4\bin" and double click on mongo.exe.
- Type following javascript program into command prompt window, which will print the output as below: var myMsg='Hello TechGeekNext User'; printjson(myMsg);
Test using MongoDB UI (MongoDB Compass)
MongoDB Compass is a MongoDB Management Tool. There are many tools present in market for managing MongoDB. MongoDB Compass is one such non-commercial tool.
- Download the MongoDB Compass from here https://www.mongodb.com/try/download/compass, select zip Package , platform as Windows and click on Download.
- Extract
mongodb-compass-1.26.1-win32-x64.zip
and double click on the downloaded MongoDBCompass.exe file. - Compass will open Welcome screen.
- Check all checkbox and click on 'Start Using Compass'.
- Enter the connection String (mongodb://127.0.0.1:27017) to conect to MongoDB which we started from above step using mongo.exe.
- Once you connect to MongoDB, you can see the home screen with all databases.
- You can create the database from here too to test.
- Once TechGeekNext database is created, you can Add Data/Import Data files.