mongodb 4 Data directory C:\data\db\ not found

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.