I figured it out, thanks to this blog post: http://stevespiga.rel.li/mongodump-mongorestore.html
Here a summary of the solution:
- I ran the command:
heroku config | grep "MONGOHQ"
. This gave me output of the form:
MONGOHQ_URL:mongodb://heroku:veryLongPasswordString@somewhere.mongohq.com:88888/app123456
.
- This can be interpreted as:
MONGOHQ_URL:mongodb://username:password@host:port/path
- Then I dumped the production db to a local directory by running:
mongodump --db <path> --host <host> --port <port> --username <username> --password <password> --out <folder for dump>
.
- Example:
mongodump --db app123456 --host somewhere.mongohq.com --port 88888 --username heroku --password veryLongPasswordString --out ./testDump
.
- The next step is to take the dumped data and restore it to your local database:
mongorestore ./testdump
.
Note, this assumes that you do NOT have a local db of the same name as the dumped db before you restore. If need be you can rename the db by following the steps outlined in this stackoverflow post.
I hope this helps!