Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering MongoDB 7.0 - Fourth Edition

You're reading from  Mastering MongoDB 7.0 - Fourth Edition

Product type Book
Published in Jan 2024
Publisher Packt
ISBN-13 9781835460474
Pages 434 pages
Edition 4th Edition
Languages
Concepts
Authors (7):
Marko Aleksendrić Marko Aleksendrić
Profile icon Marko Aleksendrić
Arek Borucki Arek Borucki
Profile icon Arek Borucki
Leandro Domingues Leandro Domingues
Profile icon Leandro Domingues
Malak Abu Hammad Malak Abu Hammad
Profile icon Malak Abu Hammad
Elie Hannouch Elie Hannouch
Profile icon Elie Hannouch
Rajesh Nair Rajesh Nair
Profile icon Rajesh Nair
Rachelle Palmer Rachelle Palmer
Profile icon Rachelle Palmer
View More author details

Table of Contents (20) Chapters

Preface 1. Chapter 1: Introduction to MongoDB 2. Chapter 2: The MongoDB Architecture 3. Chapter 3: Developer Tools 4. Chapter 4: Connecting to MongoDB 5. Chapter 5: CRUD Operations and Basic Queries 6. Chapter 6: Schema Design and Data Modeling 7. Chapter 7: Advanced Querying in MongoDB 8. Chapter 8: Aggregation 9. Chapter 9: Multi-Document ACID Transactions 10. Chapter 10: Index Optimization 11. Chapter 11: MongoDB Atlas: Powering the Future of Developer Data Platforms 12. Chapter 12: Monitoring and Backup in MongoDB 13. Chapter 13: Introduction to Atlas Search 14. Chapter 14: Integrating Applications with MongoDB 15. Chapter 15: Security 16. Chapter 16: Auditing 17. Chapter 17: Encryption 18. Index 19. Other Books You May Enjoy

Best practices

Writing and specifying good aggregations takes practice, and throughout this chapter, you have focused on some useful principles. The aggregation pipeline is a sequential set of stages, and it encourages high composability and modularity. Here are some best practices that you can keep in mind when using MongoDB aggregations:

Code modularity

No matter how complex an aggregation gets, it can and should always be broken down into simple, understandable stages that can be tested in isolation, reducing the cognitive load on the developer. If you're using Compass for prototyping your aggregations, there is an option for turning down certain stages without removing them. If you're coding in an editor, it's easier if the stages are separated, with an option to toggle the comments. The Visual Studio Code extension, introduced earlier in this book, is an excellent tool for debugging, analyzing, and synthesizing aggregation pipelines.

Finally, with JavaScript...

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 $15.99/month. Cancel anytime}