I am kind of new to mac as well as mongodb.
I have a weird doubt, accessing the database created using mongodb on mac?
I know, in windows there is a folder called c:\data\db, where my database files are stored.
How and where in mac, the database is stored.
I remember doing something like
sudo mkdir -p /data/db
sudo chown `id -u` /data/db
to create such a folder on mac, but I didn't find any database file in this folder, though i created a database.
Where are the database files saved on mac?
Any help would be really appreciated.
Env: macOS Mojave 10.14.4
Install: homebrew
Location:/usr/local/Cellar/mongodb/4.0.3_1
Note :If update version by
brew upgrade mongo
,the folder 4.0.4_1
will be removed and replace with the new version folder
Thanks @Mark, I keep forgetting this again and again. After installing MongoDB with Homebrew:
If mongodb is installed via Homebrew the default location is:
/usr/local/var/mongodb
See the answer from @simonbogarde for the location of other interesting files that are different when using Homebrew.
I had the same problem, with version 3.4.2
to run it (if you installed it with homebrew) run the process like this:
$ mongod --dbpath /usr/local/var/mongodb
I have just installed mongodb 3.4 with homebrew.(brew install mongodb) It looks for /data/db by default.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
Source: Stackoverflow.com