Home:ALL Converter>Unable to change dbpath in MongoDB using command line

Unable to change dbpath in MongoDB using command line

Ask Time:2017-01-07T18:57:43         Author:Rahul Singh

Json Formatter

I started learning mongoDB a couple of days ago. Post installation, I am trying to change the dbpath as follows:

mongod --dbpath C:\myfolder\myproj\data\db

running the above command, I got the below statements in the command line:

Now i typed the below command to check if the dbpath has changed

mongod dbpath

this line still returns:

C:\data\db

I also tried running the below command to change the dbpath (as mentioned in a youtube video https://www.youtube.com/watch?v=pWbMrx5rVBE, but still the dbpath didn't change

mongod --directoryperdb --dbpath c:\myfolder\myproj\data\db

Can someone tell me how can I change my dbpath?

I looked at the stackoverflow question MongoDB not using /etc/mongodb.conf after I changed dbpath and also Unable to change the dbpath in mongodb through mongodb.conf but none of them helped

Author:Rahul Singh,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/41520674/unable-to-change-dbpath-in-mongodb-using-command-line
yy