0

I have just started venturing into MongoDB and the world of NoSQL datatabases. Currently testing a Mongo installation on my Windows. In my config file, I wanted to use Mongo related environment variables that I have set up on my system. But on running the command:

$mongod --config $MONGO_HOME\conf\mongod.cfg --install

I get:

Error reading config file: No such file or directory
try 'mongod --help' for more information

How can I make Mongo understand and replace the environment variable with the right directory path? Here is what the config file looks like currently:

systemLog:
    destination: file
    path: $MONGO_HOME\log
storage:
    dbPath: $MONGO_HOME\data\db
René Vogt
  • 43,056
  • 14
  • 77
  • 99
  • 1
    try maybe %MONGO_HOME%\log? – It-Z Mar 12 '16 at 20:32
  • 1
    Looks like you cant do that -> http://stackoverflow.com/questions/30002680/is-it-possible-to-add-environment-variables-to-mongodb-config-file But try the It-Z's comment... – Evgeni Dimitrov Mar 12 '16 at 20:34
  • I believe you can't use environment variables in config file. You are also using bash style which will not work on Windows. I'd suggest follow MongoDB documentation at https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/ – Saleem Mar 13 '16 at 02:53
  • I corrected the to the % format @lt-Z. Had the same problem. Currently using the full path but would like to make it possible to easily switch the DB host by transferring the files later on. – Teddy Wachira Mwangi Mar 13 '16 at 03:10

0 Answers0