Home:ALL Converter>MongoDB data directory confusion

MongoDB data directory confusion

Ask Time:2019-07-22T14:45:55         Author:Yuan Hang

Json Formatter

I want to use MongoDB Compass on Windows 7 to manage my data, but I cannot figure out how to change the data directory.

I have used the command mongod --dbpath="C:\Program Files\MongoDB\Server\4.0\test"

But when I use Compass to add a new database or a collection, nothing appears in "test" folder. Instead, I got new files added in "C:\Program Files\MongoDB\Server\4.0\data", which I believe is the default directory? I think the command is not successfully executed but I don't know what to do.See screenshot

I have also tried to modify the mongodb.cfg which is located in "C:\Program Files\MongoDB\Server\4.0\bin". But it does not work either.

Can anyone help please? Thanks in advance.

Author:Yuan Hang,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57140444/mongodb-data-directory-confusion
yy