Home:ALL Converter>How to change the data dir (dbPath) in mongoDB on Windows outside STANDARD location?

How to change the data dir (dbPath) in mongoDB on Windows outside STANDARD location?

Ask Time:2022-03-25T21:33:06         Author:Danigoodw

Json Formatter

How would one change the data folder (by changing dbPath in mongo config file) to a custom location on a local Windows 10 machine?

Putting any custom path within the Users folder (while ensuring the folder exists in the path), I'm getting an error when starting the service (NET start mongoDB):

"The MongoDB Server (MongoDB) service could not be started. A service specific error occurred: 100."

See the following examples:

dbPath: C:\some\folder\data --- WORKS PERFECTLY.

dbPath: C:\Program Files\MongoDB\Server\5.0\data --- WORKS PERFECTLY.

dbPath: C:\Users\myuser\data --- GENERATES THE ERROR.

enter image description here

Author:Danigoodw,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/71617803/how-to-change-the-data-dir-dbpath-in-mongodb-on-windows-outside-standard-locat
yy