Book Image

Meteor Cookbook

By : Isaac Strack
Book Image

Meteor Cookbook

By: Isaac Strack

Overview of this book

Table of Contents (19 chapters)
Meteor Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing a simple collection


Collections are the medium of communication between the client and the server, with changes being pushed down to the client and requests being pushed up to the server. This recipe will show you how and where to declare a collection for use on both the client and the server.

Getting ready

First, you will need Meteor installed and have a project created. To create a standard project file structure, please see the Setting up your project file structure recipe in Chapter 1, Optimizing Your Workflow.

For this particular exercise, you will also need to have the autopublish and insecure packages installed (which are installed by default). If you need to add them, please see the Adding Meteor packages recipe in Chapter 2, Customizing with Packages.

How to do it...

To implement a simple collection, proceed with the following steps:

  1. Create a new file in your both folder, called simple.js.

  2. Open the simple.js file in an editor, and declare a MongoDB comments collection by entering...