0

I'm new to both using github and meteor and am running into an issue. I'm sure it's something simple but my search queries aren't pointing me in the right direction.

So I've been developing a meteor app for the last few weeks and have populated quite a few collections with some sample data that makes my app actually function. Today I tried cloning my github repo to a surface pro 3 that I just got so that I could develop my app on the go. So I install everything I need, type in meteor run, and... none of my collections are populated anymore. They're there, since I have them defined using collection2, but all the sample data's gone. How can I get the sample data that's currently on the desktop version onto github and thus onto the SP3?

Is there a certain point when the Mongodb data is saved to file? If it helps any, I haven't turned off the meteor server on my desktop ever since I started developing - would that have anything to do with it?

Thanks so much.

edit: Is this the correct solution? Is there a simple way to export the data from a meteor deployed app?

Community
  • 1
  • 1
Kris
  • 201
  • 1
  • 8

1 Answers1

0

When you create a meteor app, it comes with a .gitignore under your .meteor directory specifically to ignore your local database so you don't end up checking in hundreds of megabytes of data.

One option is to dump the data and import it as you suggested. If it should be auto-populated for any new app instance, and it can be described algorithmically, I'd recommend creating a set of fixtures for your collections that run as soon as your app starts. Usually these look like:

Meteor.startup(function() {
  if (Posts.find().count() === 0) {
    Posts.insert({title: 'fake post'});
  }
});

Also see fake which can be really helpful when auto-generating data.

David Weldon
  • 63,632
  • 11
  • 148
  • 146