2019-12-24T19:51:14.044+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /tmp/mongodb/db/ not found., terminating

q1

/tmp is not same as ~tmp
~ indicates your home directory

So you created tmp dir in your home dir but used /tmp in config file
Thats why your mongod is failing with non existent dbpath error

Also you used sudo to add delete dirs tmp,var etc
It is a powerful command.So exercise caution before you delete any dirs
Please be clear on absolute and relative paths in Unix
/ is the top most dir owned by root
so you need sudo privs to create sub dirs whereas in your homed dir you don’t need sudo

1 Like

![q2|690x399](upload://uPiZYv8P7FXX5jzTZjuldVf

  • create a new folder /var/mongodb/db/ and allow mongod to write files to this directory
    • create this directory with sudo, because /var is owned by root
    • use chown to change the owner of this directory to vagrant:vagrant
  • edit your config file to use this new directory as the dbpath

i wish to change this path to qqqq dir . could you give answer in command format

i resolved above mentioned problem

thanks for your ideas. i have resolved all errors

Closing this thread as the issue has been resolved.