Steps:
- Download MongoDB this link link.
Review MongoDB folder.
In MongoDB, it contains only executable files 10 Plus(exe) in the bin folder.path:- Files under $MongoDB/bin folder
Configuration File
Create a MongoDB config file, it’s just a text file, for exampleC:\mongodb\mongo.config
:#store data here dbpath=C:\mongodb\data \\all output go here logpath=C:\mongodb\log\mongo.log \\log read and write operations diaglog=3
Run MongoDB server
Usemongod.exe --config C:\mongodb\mongo.config
to start MongoDB server.C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
All output going to:
C:\mongodb\log\mongo.log
Connect to MongoDB
Uses mongo.exe to connect to the started MongoDB server.C:\mongodb\bin>mongo MongoDB shell version: 2.2.3 connecting to: test
//mongodb shell
MongoDB as Windows Service
Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart. Install as Windows Service with--install
.C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
A Windows service named “MongoDB” is created.
To start MongoDB Service:
net start MongoDB
To stop MongoDB Service
net stop MongoDB
To remove MongoDB Service
C:\mongodb\bin>mongod --remove