I download and install the last vesrion of MongoDb which is 4.0.2 and i set the correct path variable.
When i want to start the mondoDb service using mongod
command i got the following error:
exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
i know that i should create the directory missing, but that directory is automatically created in the following path: C:\Program Files\MongoDB\Server\4.0
I checked the mongod.cfg file and the correct path is already set : dbPath: C:\Program Files\MongoDB\Server\4.0\data
Now how to tell the mongo to look for the folder he thinks is missing in the correct path ?
I too had the same issue after an Windows update, Mongodb did not start automatically. Creating a new directory C:data/db will not be the right way as Mongodb has already configured the directory C:\Program Files\MongoDB\Server\4.0\data as datapath.
Run the following command in cmd as Administrator.
cd C:\Program Files\MongoDB\Server\4.0\bin
mongod --dbpath="C:\Program Files\MongoDB\Server\4.0\data".
This worked for me.
I had the same issue but after I create the directory C:\data\db\
it just worked.
i tried to open CMD in admin mode and the error was gone. Hope this helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With