Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is mongo db database stored on local hard drive?

I'm scraping tweets and inserting them into a mongo database for analysis work in python. I want to check the size of my database so that I won't incur additional charges if I run this on amazon. How can I tell how big my current mongo database is on osx? And will a free tier cover me?

like image 786
The Internet Avatar asked Nov 13 '12 22:11

The Internet


Video Answer


2 Answers

For posterity:

Run the mongo shell: mongo

In the shell run: db.adminCommand("getCmdLineOpts")

This will give the location of the relative files, including the db path. Here are the results from two machines I have running mongo.

"parsed": {
    "config": "/usr/local/etc/mongod.conf",
    "dbpath": "/usr/local/var/mongodb",
    "logappend": "true",
    "logpath": "/usr/local/var/log/mongodb/mongo.log"
    },


"parsed" : {
    "config" : "/etc/mongodb.conf",
    "dbpath" : "/var/lib/mongodb",
    "logappend" : "true",
    "logpath" : "/var/log/mongodb/mongodb.log",
},
like image 149
Sean McClory Avatar answered Oct 07 '22 16:10

Sean McClory


I believe on OSX the default location would be /data/db. But you can check your config file for the dbpath value to verify.

like image 38
Mike Brant Avatar answered Oct 07 '22 16:10

Mike Brant