Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical MongoDB Aggregations

You're reading from   Practical MongoDB Aggregations The official guide to developing optimal aggregation pipelines with MongoDB 7.0

Arrow left icon
Product type Paperback
Published in Sep 2023
Publisher Packt
ISBN-13 9781835080641
Length 312 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Paul Done Paul Done
Author Profile Icon Paul Done
Paul Done
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Chapter 1: MongoDB Aggregations Explained 2. Part 1: Guiding Tips and Principles FREE CHAPTER
3. Chapter 2: Optimizing Pipelines for Productivity 4. Chapter 3: Optimizing Pipelines for Performance 5. Chapter 4: Harnessing the Power of Expressions 6. Chapter 5: Optimizing Pipelines for Sharded Clusters 7. Part 2: Aggregations by Example
8. Chapter 6: Foundational Examples: Filtering, Grouping, and Unwinding 9. Chapter 7: Joining Data Examples 10. Chapter 8: Fixing and Generating Data Examples 11. Chapter 9: Trend Analysis Examples 12. Chapter 10: Securing Data Examples 13. Chapter 11: Time-Series Examples 14. Chapter 12: Array Manipulation Examples 15. Chapter 13: Full-Text Search Examples 16. Afterword
17. Index 18. Other books you may enjoy Appendix

What is the MongoDB aggregation framework?

The MongoDB aggregation framework enables you to perform data processing and manipulation on the documents in one or more MongoDB collections. It allows you to perform data transformations and gather summary data using various operators for filtering, grouping, sorting, and reshaping documents. You construct a pipeline consisting of one or more stages, each applying a specific transformation operation on the documents as they pass through the pipeline. One of the common uses of an aggregation pipeline is to calculate sums and averages, similar to using SQL's GROUP BY clause in a relational database but tailored to the MongoDB document-oriented structure.

The MongoDB aggregation framework enables users to send an analytics or data processing workload—written using an aggregation language—to the database to execute the workload against the data it holds. The MongoDB aggregation framework has two parts:

  • An aggregation API provided by the MongoDB driver that you embed in your application. You define an aggregation pipeline in your application's code and send it to the database for processing.
  • The aggregation runtime in the database that receives the pipeline request from the application and executes the pipeline against the persisted data.

Figure 1.1 illustrates these two elements and their relationship:

Figure 1.1: MongoDB aggregation framework

Each driver provides APIs to enable an application to use both the MongoDB Query Language (MQL) and the aggregation framework. In the database, the aggregation runtime reuses the query runtime to efficiently execute the query part of an aggregation workload that typically appears at the start of an aggregation pipeline.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime