Create MongoDB service in Windows OS
1) Open Command Prompt 2) Create directory for Database and Logs mkdir c:\data\db mkdir c:\data\log 3) Create a file at C:\mongodb\mongod.cfg and specifies both systemLog Path and Storage database path Add following in mongod.cfg file : systemLog : destination : file path : c:\data\log\mongod.log storage : dbPath : c:\data\db 4) Create service named as "MongoDB" using following command sc.exe create MongoDB binPath= "C:\mongodb\bin\mongod.exe --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto" 5) To remove MongoDB service use following command sc . exe delete MongoDB