Validation saying path is wrong

I have tried running the config file with the following DB path:

dbPath: “/var/mongodb/db”
or
dbPath: “/var/mongodb/db/”

When I try it says:

“/var/mongodb/db not found., terminating”

However, if I change to “var/mongodb/db” it will work and load, but when I try to run the validation it tells me:

“You need to specify the dbPath as /var/mongodb/db.”

Really cannot figure out what I am missing here.

The instruction are clear. The path has to be /var/mongodb/db. Note that var/mongodb/db is not the same, the leading slash is very important, just like c: in windows. If /var/mongodb/db is not found, then you must create it. You probably create var/mongodb/db since it exists.

2 Likes

Continuing the discussion from Validation saying path is wrong:

I am also have a similar circumstance. I am running on windows, and have created the file path /var/mongodb/db in the C:drive, by right click creating the folders. When i place the file path into the .conf file, it is writing that the Data directory is not found. There is also information about creating a linux user, in the lab exercise (does this require Windows linux subsystem?). The /data/db worked fine.

1 Like

Hi Liam, did you find out what the issue was here? I’m getting the exact same thing. It won’t let me create it with the “/” at the front, and it’s all working fine when i don’t put it at the front, however lab wont let me validate… exact same error as you have

The error message you see whilst creating the sub directory is a good indicator as to why it won’t create the file, i.e. permission denied. The /var directory is owned by another user (i.e. root) and you’ll need elevated privileges to create a sub dir under /var. Additionally, in order for mongod to run, you will need to change the ownership of that newly created sub dir to the user called vagrant.
In order to achieve this, you need the sudo and chown Linux commands. Look into those.

As for this specific error, @steevej-1495 has already explained why it’s failing.

PS: It’s best to create your own thread instead of awakening an old thread.

Hi @joelgabauer,

As I can see, you have already completed this lab. Please feel free to create another thread if you have any other issue.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Closing this thread as the original issue has been resolved.