Where Does MongoDB Store Data Files?
MongoDB dbPath defaults on Windows, Linux and Mac plus the config file that overrides them.
Last updated
MongoDB keeps databases under a dbPath holding WiredTiger files, journals and the mongod.lock. The default differs per OS and install method.
Read the config file (mongod.conf/mongod.cfg) for the live storage.dbPath. Package defaults lose to that file every time.
Where MongoDB stores this, by platform
C:\Program Files\MongoDB\Server\[Version]\data\db
MSI default with version in the path. Config at bin/mongod.cfg overrides it; check storage.dbPath there.
/var/lib/mongodb
Debian/Ubuntu package default. Config at /etc/mongod.conf. Needs mongod user ownership for the server to start.
/opt/homebrew/var/mongodb
Homebrew default on Apple Silicon (Intel uses /usr/local/var). Config file beside it sets the live path.
Frequently asked questions
How do I find the dbPath my MongoDB uses?
Read storage.dbPath in the active mongod config, or query getCmdLineOpts from the shell. Both beat guessing.
Can I copy data files as backup?
Only with mongod stopped and matching versions. mongodump gives portable BSON that restores anywhere.
Notice an outdated path? Let us know.