Chapter 5. Queries and aggregation

 

In this chapter

  • Querying an e-commerce data model
  • The MongoDB query language in detail
  • Aggregation with map-reduce and group

MongoDB doesn’t use SQL. Rather, it features its own JSON-like query language. We’ve been exploring this language throughout the book, but here we turn to some meatier, real-world examples. In particular, we’re going to revisit the e-commerce data model introduced in the last chapter and present a variety of queries against it. Among the queries you’ll practice are _id lookups, ranges, ordering, and projections. We’ll also survey the MongoDB query language as a whole, looking at each available query operator in detail.

In addition to queries, we’ll cover the related topic of aggregation. Queries allow you to get at the data as it’s stored; aggregation functions summarize and reframe that data. First you’ll see how to aggregate over this book’s sample e-commerce data set, focusing on MongoDB’s group and map-reduce functions. Later I’ll present a complete reference to these functions.

5.1. E-commerce queries

 
 
 
 

5.2. MongoDB’s query language

 

5.3. Aggregating orders

 
 
 

5.4. Aggregation in detail

 
 
 
 

5.5. Summary

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest