I just installed mongoDB in my windows machine
MongoDB version : Windows 64-bit 2008 R2+ release 3.0.4
OS Version : Microsoft Windows 7 Ultimate 64-bit
Installation Directory: "C:\Program Files\MongoDB"
instead of creating the database in default C:\data\db\
, I created a directory in the installation directory, i.e. C:\Program Files\MongoDB\data\db
. Now I can run mongod
server by the command
mongod --dbpath "C:\Program Files\MongoDB\data\db"
If I run only mongod
it throws an exception saying
[initandlisten] exception in initAndListen: 29 Data directory C:\data\db\ not found., terminating
So, apparently the default dbpath is set to C:\data\db\
. Each time I run mongod, I have to explicitly specify --dbpath
Is there a way to override the default dbpath
value? I have tried following this answer, which solved the issue. But as there were no default mongod.cfg
file, now I have to tun the command:
mongod --config "C:\Program Files\MongoDB\mongod.cfg"
Which doesn't help much, because now I have to explicitly specify --config
each time. All I want to do is just type mongod
, each time I want to start mongo server. How can this be done?