I've written a CLI plugin for working with MongoDB storage:
Install it by running:
$ heroku plugins:install https://github.com/Empeeric/heroku-mongo.git
Then you can get a db-dump of the current data:
$ heroku mongo:dump
and later restore that data.
$ heroku mongo:restore
(One caveat is the copy of system.*
collections. Watch out for these)
You can also simply heroku mongo
to open a console to the current DB associated with you app (specified by MONGOLAB_URI
or MONGOHQ_URL
)
Hit heroku mongo --help
for the other commands.
Edit:
I'm added two aliases for the dump
and restore
commands.
Also added a flag to automaticly load dumped data into a local DB:
$ heroku dump -l
this will dump the DB used by the app (inferred from heroku config
) and load it to a local instance into a DB named the same as the app.