Sammy Sammy - 3 months ago 9
Git Question

How to set up db in Meteor.js?

I am new to Meteor. I downloaded a git repo of a friends project. I want to "initiate" the database, as the local folder is in the .gitignore.

In Rails, it would be something like

rake db:setup
which would grab all of the migrations and set up the database. How do I do something similar in Meteor? I also see that there are no
db, lib, or local
folders in the project.

My goal here is to seed the database, for which I am using
node-mongo-seeds


Thank you!

Answer

Meteor does not have an official or structured DB seeding or migrations API as Rails does.

Some apps include code that runs on startup and seed empty collections. Some community packages that perform migrations are no longer maintained.

Note that MongoDB is schemaless, so adding fields to the schema (defined in code, usually via SimpleSchema) is less "traumatic" than in SQL databases, with its pros and cons.

You can try to figure out if the application used one of the migration packages by looking at the package list (by running meteor list or looking at the .meteor/packages file).

There's also a video from a MeteorTLV meetup regarding migrations.

Comments