Part 2. Application development in MongoDB – MongoDB in Action

Part 2. Application development in MongoDB

The second part of this book is a deep exploration of MongoDB’s document data model, query language, and CRUD (create, read, update, and delete) operations.

We’ll make these topics concrete by progressively designing an e-commerce data model and the CRUD operations necessary for managing such data. Thus each chapter will present its subject matter in a top-down fashion, first by presenting examples within the sample e-commerce application’s domain, and then by systematically filling in the details. On your first reading, you may want to read the e-commerce examples only and save the detailed material for later, or vice versa.

In chapter 4, you’ll learn some schema design principles and then construct a basic e-commerce data model for products, categories, users, orders, and product reviews. Then you’ll learn about how MongoDB organizes data on the database, collection, and document levels. This will include a summary of BSON’s core data types.

Chapter 5 covers MongoDB’s query language and aggregation functions. You’ll learn how to issue common queries against the data model developed in the previous chapter, and you’ll practice a few aggregations. Then, in the nuts and bolts sections, you’ll see the semantics of query operators presented in detail. The chapter ends with an explanation of the map-reduce and grouping functions.

In presenting MongoDB’s update and delete operations, chapter 6 brings us full circle by showing the rationale for the e-commerce data model. You’ll learn how to maintain the category hierarchy and how to manage inventory transactionally. In addition, the update operators will be covered in detail along with the powerful findAndModify command.