Create a file called mongod.cfg in MongoDB folder if you dont has it. In my Case:c:\users\ivanbtrujillo\mongodb
Then, edit mongod.cfg with Notepad and add a line with the following (our custom DBPath):
dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db
In this file you should especify the LogPath too. My mongod.cfg file is:
logpath=C:\Users\ivanbtrujillo\MongoDB\log\mongo.logdbpath=C:\Users\ivanbtrujillo\MongoDB\data\db
If you are uses MongoDB as a Windows service, you have the "to" change this key and especify the Mongod.cfg file.
To install the MongoDB as a Windows service run this command:
**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" –install**
Open Regedit.exe and go to the following route:
HKEYLOCALMACHINE\SYSTEM\CurrentControlSet\services\MongoDB
MongoDB service does not work, we had to edit the ImagePath key, delete its content and put the following:
**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" --logpath="C:\Users\ivanbtrujillo\MongoDB\log\mongo.log" –service**
We indicates to MONGO it's config file and its logpath.
Then when you init the MongoDB service, it works.
Here's a full tutorial to install MongoDB in windows:http://ivanbtrujillo.herokuapp.com/2014/07/24/ installing-mongodb-as-a-service-windows/
Modify the DB and Log storage paths for MongoDB (Windows)-excerpt from the network