Seeding a Heroku Application's MongoLab Mongo Database

The following blog post is an adapted excerpt from the forthcoming book, "Easy React: Build Powerful Web Apps Using Modern JavaScript Technologies", by W. Jason Gilmore. See the table of contents to read the introduction and chapter 1 online for free!

If you're using Heroku's fantastic MongoLab Add-On and were wondering how to seed the hosted database, the answer is easier than you think!

Just connect to it from your local terminal using the credentials provided to you after associating the Add-On with your project. Here's an example:

$ mongo \
> -u heroku_username -p super_secret_pswd \
> database/seeds/seeds.js

Written by W. Jason Gilmore on Jul 12, 2015