Collections and Schemas

Collections and Schemas

How to define, use, and maintain MongoDB collections in Meteor.

After reading this guide, you’ll know:

  1. The different types of MongoDB collections in Meteor, and how to use them.
  2. How to define a schema for a collection to control its content.
  3. What to consider when defining your collection’s schema.
  4. How to enforce the schema when writing to a collection.
  5. How to carefully change the schema of your collection.
  6. How to deal with associations between records.

MongoDB collections in Meteor

At its core, a web application offers its users a view into, and a way to modify, a persistent set of data. Whether managing a list of todos, or ordering a car to pick you up, you are interacting with a permanent but constantly changing data layer.

In Meteor, that data layer is typically stored in MongoDB. A s