1

Is there a way to over-rite the mongodb default db path. Even after editing the storage path in mongod.conf to the custom directory path. Still it looks for /data/db, and not the custom path.

Since every time mongod path needs to be specified for the custom path.

mongod --dbpath /Users/customData

Is there a permanent way to deal this.

Thillai Narayanan
  • 4,766
  • 5
  • 32
  • 39

2 Answers2

0

You can try to run it as a service, so that you don't need to run this command everytime you want to use it, and it runs it in the path you set it to

Here's how: the link

from official mongodb website: the link

imans77
  • 516
  • 5
  • 16
0

According to documentation of MongoDB

To run a mongod process as a daemon (i.e. fork), and write its output to a log file, use the --fork and --logpath options. You must create the log directory; however, mongod will create the log file if it does not exist.

The following command starts mongod as a daemon and records log output to /var/log/mongodb.log.

mongod --fork --logpath /var/log/mongodb.log

Rubin Porwal
  • 3,736
  • 1
  • 23
  • 26