So today I decided it’s time for the app to be live on the internets!
First off, I migrated the app to heroku (pretty straightforward process, instructions can be found here: https://devcenter.heroku.com/articles/nodejs and I wrote about migration to Heroku/Mongolab my post)
Then, of course, needed to migrate the existing local mongo database to Mongolab.
Step 1: export your local mongo database using mongodump:
In terminal, find your mongo directory and run
./mongodump or bin/mongodump
This will create a directory “dump” with all existing databases and collections
Note: if you only need to export certain databases or collections, read up the instructions on the mongo site
Step 2: import your dumped db files to Mongolab:
bin/mongorestore -h .mongolab.com: -d -u -p dump/
The values for db name, port, app id can be easily found through Mongolab admin console:
As you see, once imported, your collections will be listed in the admin console.
Thank you for this very helpful post!
Hey Tanya, I found this super helpful while trying to sync my local database with an mLab project. Much clearer and way more concise than reading through the official mongo docs. Nice work!