Ubuntu – Where is mongo database folder on the filesystem

16.04databasefilesfilesystemmongodb

I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).

The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.

I also showed hidden files and folders with Ctrl+H.

How can I find my database folder?

Best Answer

You should be able to find the location in the configuration file: /etc/mongod.conf

grep -i dbPath /etc/mongod.conf

According to mongodb docs:

The default path is /data/db directory

By default, MongoDB listens for connections from clients on port 27017, and stores data in the /data/db directory.

If dbPath is set, the mongodb will use the directory specify by dbPath

If you want mongod to store data files at a path other than /data/db you can specify a dbPath. The dbPath must exist before you start mongod. If it does not exist, create the directory and the permissions so that mongod can read and write data to this path. For more information on permissions, see the security operations documentation.

Related Question