Why does Meteor lose collection values when using git

233 Views Asked by At

So here is the problem: Everytime I insert new values into my collection (lets call it "Locations" Collection) and submit my changes to my Git repository, I lose all changes that I have made to this collection.

Shouldn't Git upload all changes I have done, including the new Collection Values? Or does git somehow ignore the .meteor directory where the values are stored?

I am currenty using Meteor 1.0.1 locally.

1

There are 1 best solutions below

0
On BEST ANSWER

Short answer: No...

Long answer:

By default, the .meteor folder that is created when you create a Meteor project contains a .git-ignore file that ignores several files and folders. One of those folders is the one that contains the local MongoDB data. It is not intended to deploy your development code to Production, hence why it doesn't save the data to the GIT repo, since you shouldn't be doing that anyhow.

If you have some default values, what I would suggest is doing a placing come code like this in your /server folder, after you create your Collections:

if (Meteor.isServer) {
  Meteor.startup(function() {
    // Do your data insert in here...
    if (MyCollections.find().count() == 0) {
      // Insert me some MyCollections
    }
  });
}

This way you can cover your Production environment where you should be running MongoDB externally.