Issue with Lab - Change the Default DB Path

Hi I am facing weird issues on this. I am unable to connect to mongod instance using dbpath as “/var/mongodb/db/” but able to do so using “./var/mongodb/db/” (a dot at the beginning). Using the latter one I am unable to validate. I am working on Windows 10. How can I resolve this issue?

I have the same problem. Below in my next post is a recent attempt at starting mongod and subsequent exploration of the file structure just to show the error message and verify the file structure. The log file shown in my ls of the top level directory is from an instance of mongodb on my host (windows) computer. I wonder if that has anything to do with the situation. I’m stumped too, and I don’t know why the dot seems to help starting up mongod, but not allowing authentication.

vagrant@m103:~ ls C:\Program Files\MongoDB\Server\4.0\log\mongod.log data first_mongod var vagrant@m103:~ mongod --config /shared/mongod.cfg
2019-05-21T09:46:54.339+0000 I CONTROL [initandlisten] MongoDB starting : pid=1967 port=27000 dbpath=/var/mongodb/db/ 64-bit host=m103
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] db version v3.6.12
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] git version: c2b9acad0248ca06b14ef1640734b5d0595b55f1
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] modules: enterprise
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] build environment:
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] distarch: x86_64
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-05-21T09:46:54.340+0000 I CONTROL [initandlisten] options: { config: “/shared/mongod.cfg”, net: { bindIp: “192.168.103.100,localhost”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/var/mongodb/db/” } }
2019-05-21T09:46:54.413+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /var/mongodb/db/ not found., terminating
2019-05-21T09:46:54.413+0000 I CONTROL [initandlisten] now exiting
2019-05-21T09:46:54.413+0000 I CONTROL [initandlisten] shutting down with code:100
vagrant@m103:~ ls var mongodb vagrant@m103:~ cd var
vagrant@m103:~/var$ ls
mongodb
vagrant@m103:~/var$ cd mongodb
vagrant@m103:~/var/mongodb$ ls
db

Hi @Bruce_02966, @codesavant,

Please create the directory /var/mongodb/db/ and give permissions as mentioned in the lab.

 sudo mkdir -p /var/mongodb/db
 sudo chown vagrant:vagrant /var/mongodb/db

Kanika