Need help on running config file

vagrant@m103:~ mongod --config "C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg" Error reading config file: No such file or directory try 'mongod --help' for more information vagrant@m103:~

You are on the vagrant VM. As the error message indicate there is no C: drive. You have to specify a file that exist in vagrant.

"C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg" is the default config file used by mongodb on windows. You do not need to specify this file. Instead create a new config file yourself and specify its path using --config option.

Hi Nikola_31445,

There are two ways of doing this:

  1. Copy the config file from your local (Windows) to Vagrant (shared directory) using below command. You need to run this from outside your local system and then you can ssh to vagrant and access in vagrant under ls /shared/:

    > cp C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg ..\m103-vagrant-env\shared
    
  2. Create config file in Vagrant using any of the editor like vim, nano or using cat command.

Kanika

Actually I just tried to create a file in the shared directory in Windows and that is accessible from /shared on the vagrant VM right away :slight_smile:

If you want to be super nerdy and manual about it I noticed the vagrant environment is loaded with Vim Editor.

I ended up copying the default configuration file into the new location and edited it with a…

$ sudo vim

:sweat_smile: had the think far back to remember my Vim commands :laughing: