Search code examples
mongodbmeteorwebstorm

How to insert data to MongoDB when using meteor


I'm having trouble using MongoDB with Meteor (using Webstorm 10).

do you know a nice way to perform "Seed" migration?

I heard about Mongo Plugin , but the internet documentation for the plugin is poor, and I just can't understand how to use the MongoExplorer.

Any Suggestions?


Solution

  • Insert some data when the application starts is quite simple : Insert data in collection at Meteor's startup or http://eureka.ykyuen.info/2015/02/19/meteor-insert-sample-data-if-the-mongodb-is-empty/.

    If you want to edit the schema from version X to version Y, you can look at this existing Meteor project : https://github.com/wekan/wekan/blob/devel/server/migrations.js.

    If you look for awesome pattern to make migration (seed, rollback, etc ...), this is an awesome one (but in PHP): http://laravel.com/docs/5.1/migrations