On Thursday, 30 July 2015 22:34:12 UTC+10, Wyatt Biker wrote:
I am just starting with MongoDB. So I know one can do this example to have mongod read the configuration file:
mongod --config /etc/mongod.conf
But is there a default location that mongod reads a configuration file from? If there is, what is it or how do I find out. I prefer not having to specify a --config parameter when I start mongod.
Hi Wyatt,
There is no default configuration file baked into `mongod`. Typically you would start mongod via a service definition which would provide a config path that makes sense for your operating system conventions. For example, for Ubuntu this would be `/etc/mongod.conf` if you installed from the official MongoDB packages.
For more information, check the docs relevant to your install:
Also is there a mongo command to give me the current path of the db (or config file).
You can find the command line arguments and parsed values in the `mongo` shell using:
db.serverCmdLineOpts()
For example, the current dbpath (if specified) would be:
db.serverCmdLineOpts().parsed.storage.dbPath
The default dbpath is /data/db.
Regards,
Stephen