Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with MongoDB


MongoDB is a no-SQL document database. Instead of saving data as rows within tables with a fixed column structure, a document database offers much more flexibility allowing you to simply store objects, retrieve, update, and delete complex objects.

For example, you might have customer orders, invoices, and payments. In a relational SQL-based database, this data would likely be spread across four or more tables: Customers, Orders, Invoices, Payments, and several other master tables (Addresses, Cities, Order Details, Products, and so on). To determine whether a customer's account has been paid in full, we need to query the data across a number of tables.

In MongoDB, we can store a customer as a document. This document could contain a collection of orders; each order in turn could contain a collection of payment details.

Document databases, in general, greatly facilitate the retrieval of comprehensive information for a given entity.

In this section, we will use CoffeeScript...