Step by Step instructions:
1. Download MongoDB
Check MongoDB msi from Official website and download Windows Server 2008 R2 64-bit and later version.
2. Install MongoDB
Double click on downloaded MSI (mongodb-win32-x86_64-2008plus-ssl-3.2.11-signed.msi) file and follow the click on next button on wizard to complete the installation.
3. Create Default Directory
MongoDB requires a data directory to store all data and its default data directory path is \data\db.
On Windows, By default it will always look for above directory under C:/ structure, Goto C: directory and create /data/db, So the full path of db folder will be C:\data\db
4. Set environment variables
Set MongoDB location to system's environment variables and give path till bin folder.
5.
5. Start MongoDB
To start MongoDB server, Open cmd and type mongod, it will start the MongoDb server on port -27017.
6
6. Verify MongoDB
Open cmd prompt and type mongo.exe
Additional Notes:
1. Configuration File
We can create a config file where we can add the custom path of data/db directory, Config file will be similar to properties file and add attributes in key/value pair.
##data path can be updated using dbpath
dbpath=E:\mongodb\data
##log file
logpath=E:\mongodb\log\mongo.log
Use mongod.exe –config E:/mongodb/mongo.config to load config file while starting mongodb2.
2. Start as a service
We can start mongoDB as a service, Adding MongoDB as Windows Service will start MongoDB automatically following each system restart. Install as Windows Service with --install.
E:\mongodb\bin> mongod --config E:\mongodb\mongo.config --install
To start
MongoDB Service
net
start MongoDB
To stop
MongoDB Service
net
stop MongoDB
To remove
MongoDB Service
d:\mongodb\bin>mongod
--remove
Thank you..!!!