I'm quite confused on how to create a YAML file

how do I create the yaml file and where? is it in the vagrant terminal? The detailed answer is not clear for me.Its just the structure of the yaml file.

You create the configuration with any editor you know, even notepad can be used. You just have to follow the YAML syntax. If you go back at the lesson Chapter 1 - The mongod configuration file at around 5:00 (in my version of the course anyway) you will see how it looks.

On the vagrant machine you may look at the file /etc/mongod.conf to get a feeling of what it looks like. But DO NOT MODIFY this file. You may copy it elsewhere and change it but leave the origin unchanged at its place.

The file may reside where ever you want. But if you edit it in Windows, or if you preserve it after the vagrant VM is destroyed it is best to put it in the shared directory.


Ok I get it. But how can I paste the yaml file that I created into /etc/mongod.conf in the vagrant machine?

Please read carefully


Reread the lectures. You MUST create a new file.

1 Like

It seems that some Windows users get confused with this whole concept so I’ll expand a little with some steps:

  1. Open a Text Editor (Notepad++, Sublime Text, Notepad etc)
    • click File menu > Save As
    • Navigate to the m103-env folder (i.e. the same location as the vagrantfile)
    • go one level down into the shared folder
    • change the Save As Type to All Types (.)
    • enter a File Name ensuring that it ends with “.conf
    • hit Save
    • *** This is now your config file ***
  2. Type/paste in your config options based on the documentation and lecture @steevej-1495 mentioned, and hit Save
  3. The shared folder on your host machine…
    … will be synced to the /shared directory on the vagrant VM. To confirm run this command on the VM:
  4. So if your config file is called mongod.conf, you can run it from the VM like so:
    • mongod -f /shared/mongod.conf
    • mongod --config /shared/mongod.conf

@007_jb that worked ! Thank you guys @007_jb && @steevej-1495 for helping me out :laughing:

1 Like

Closing this thread as the issue has been resolved.