[SOLVED] Export db to create bootstrap code

Like many projects, I have a file called bootstrap.js that initializes a bunch of collections:

if (Regions.find().count() === 0) {
   Regions.insert({name: "MyTown", .... });

I don’t want to type all of my documents in because the interface that I created is much more efficient. Now I have all of my documents loaded in the database, my questions is, how do I export the documents to get them into bootstrap.js file?

Here’s what I’ve ended up doing…

Install nimble:restivus

meteor add nimble:restivus

Added the Regions code as follows

if(Meteor.isServer) {
  var Api = new Restivus({
    useDefaultAuth: true,
    prettyJson: true

  Api.addCollection(Regions, {
    authRequired: false

Ran curl from the command line

curl -X http://localhost:3000/api/Regions > myTempFile.json

Then I copied the json array into my bootstrap file.

I hope this helps someone in the future. I’m interested to know if there is a better way.