Synopses & Reviews
How does MongoDB help you manage a huMONGOus amount of data collected through your web application? With this authoritative introduction, youll learn the many advantages of using document-oriented databases, and discover why MongoDB is a reliable, high-performance system that allows for almost infinite horizontal scalability.
Written by a core contributor to the MongoDB project, this updated second edition provides guidance for database developers, advanced configuration for system administrators, and an overview of the concepts and use cases for other people on your project. Ideal for newcomers to NoSQL databases and experienced MongoDB users alike, this edition provides numerous real-world schema design examples.
- Learn about new features, including TTL collections, MMS, and the aggregation pipeline
- Find additional chapters on deploying MongoDB, including application and server administration as well as ops advice
- Explore ways that document-oriented storage will work for your project
- Learn how MongoDBs schema-free data model handles documents, collections, and multiple databases
- Execute basic write operations, and create complex queries to find data with any criteria
- Learn about monitoring, security and authentication, backup and repair, and more
- Set up master-slave and automatic failover replication in MongoDB
- Use sharding to scale MongoDB horizontally, and learn how it impacts applications
Manage the huMONGOus amount of data collected through your web application with MongoDB. This authoritative introduction—written by a core contributor to the project—shows you the many advantages of using document-oriented databases, and demonstrates how this reliable, high-performance system allows for almost infinite horizontal scalability.
This updated second edition provides guidance for database developers, advanced configuration for system administrators, and an overview of the concepts and use cases for other people on your project. Ideal for NoSQL newcomers and experienced MongoDB users alike, this guide provides numerous real-world schema design examples.
- Get started with MongoDB core concepts and vocabulary
- Perform basic write operations at different levels of safety and speed
- Create complex queries, with options for limiting, skipping, and sorting results
- Design an application that works well with MongoDB
- Aggregate data, including counting, finding distinct values, grouping documents, and using MapReduce
- Gather and interpret statistics about your collections and databases
- Set up replica sets and automatic failover in MongoDB
- Use sharding to scale horizontally, and learn how it impacts applications
- Delve into monitoring, security and authentication, backup/restore, and other administrative tasks
About the Author
Kristina is a software engineer who worked on the MongoDB core for five years. She led MongoDB's replica set development as well as writing the PHP and Perl drivers. She has given talks on MongoDB at meetups and conferences around the world and maintains a blog on technical topics at http://www.kchodorow.com. She currently works at Google.
Table of Contents
Foreword; Preface; How This Book Is Organized; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Introduction to MongoDB; Chapter 1: Introduction; 1.1 Ease of Use; 1.2 Easy Scaling; 1.3 Tons of Features...; 1.4 ...Without Sacrificing Speed; 1.5 Let's Get Started; Chapter 2: Getting Started; 2.1 Documents; 2.2 Collections; 2.3 Databases; 2.4 Getting and Starting MongoDB; 2.5 Introduction to the MongoDB Shell; 2.6 Data Types; 2.7 Using the MongoDB Shell; Chapter 3: Creating, Updating, and Deleting Documents; 3.1 Inserting and Saving Documents; 3.2 Removing Documents; 3.3 Updating Documents; 3.4 Setting a Write Concern; Chapter 4: Querying; 4.1 Introduction to find; 4.2 Query Criteria; 4.3 Type-Specific Queries; 4.4 $where Queries; 4.5 Cursors; 4.6 Database Commands; Designing Your Application; Chapter 5: Indexing; 5.1 Introduction to Indexing; 5.2 Using explain() and hint(); 5.3 When Not to Index; 5.4 Types of Indexes; 5.5 Index Administration; Chapter 6: Special Index and Collection Types; 6.1 Capped Collections; 6.2 Time-To-Live Indexes; 6.3 Full-Text Indexes; 6.4 Geospatial Indexing; 6.5 Storing Files with GridFS; Chapter 7: Aggregation; 7.1 The Aggregation Framework; 7.2 Pipeline Operations; 7.3 MapReduce; 7.4 Aggregation Commands; Chapter 8: Application Design; 8.1 Normalization versus Denormalization; 8.2 Optimizations for Data Manipulation; 8.3 Planning Out Databases and Collections; 8.4 Managing Consistency; 8.5 Migrating Schemas; 8.6 When Not to Use MongoDB; Replication; Chapter 9: Setting Up a Replica Set; 9.1 Introduction to Replication; 9.2 A One-Minute Test Setup; 9.3 Configuring a Replica Set; 9.4 Changing Your Replica Set Configuration; 9.5 How to Design a Set; 9.6 Member Configuration Options; Chapter 10: Components of a Replica Set; 10.1 Syncing; 10.2 Heartbeats; 10.3 Elections; 10.4 Rollbacks; Chapter 11: Connecting to a Replica Set from Your Application; 11.1 Client-to-Replica-Set Connection Behavior; 11.2 Waiting for Replication on Writes; 11.3 Custom Replication Guarantees; 11.4 Sending Reads to Secondaries; Chapter 12: Administration; 12.1 Starting Members in Standalone Mode; 12.2 Replica Set Configuration; 12.3 Manipulating Member State; 12.4 Monitoring Replication; 12.5 Master-Slave; Sharding; Chapter 13: Introduction to Sharding; 13.1 Introduction to Sharding; 13.2 Understanding the Components of a Cluster; 13.3 A One-Minute Test Setup; Chapter 14: Configuring Sharding; 14.1 When to Shard; 14.2 Starting the Servers; 14.3 How MongoDB Tracks Cluster Data; 14.4 The Balancer; Chapter 15: Choosing a Shard Key; 15.1 Taking Stock of Your Usage; 15.2 Picturing Distributions; 15.3 Shard Key Strategies; 15.4 Shard Key Rules and Guidelines; 15.5 Controlling Data Distribution; Chapter 16: Sharding Administration; 16.1 Seeing the Current State; 16.2 Tracking Network Connections; 16.3 Server Administration; 16.4 Balancing Data; Application Administration; Chapter 17: Seeing What Your Application Is Doing; 17.1 Seeing the Current Operations; 17.2 Using the System Profiler; 17.3 Calculating Sizes; 17.4 Using mongotop and mongostat; Chapter 18: Data Administration; 18.1 Setting Up Authentication; 18.2 Creating and Deleting Indexes; 18.3 Preheating Data; 18.4 Compacting Data; 18.5 Moving Collections; 18.6 Preallocating Data Files; Chapter 19: Durability; 19.1 What Journaling Does; 19.2 Turning Off Journaling; 19.3 What MongoDB Does Not Guarantee; 19.4 Checking for Corruption; 19.5 Durability with Replication; Server Administration; Chapter 20: Starting and Stopping MongoDB; 20.1 Starting from the Command Line; 20.2 Stopping MongoDB; 20.3 Security; 20.4 Logging; Chapter 21: Monitoring MongoDB; 21.1 Monitoring Memory Usage; 21.2 Calculating the Working Set; 21.3 Tracking Performance; 21.4 Monitoring Replication; Chapter 22: Making Backups; 22.1 Backing Up a Server; 22.2 Backing Up a Replica Set; 22.3 Backing Up a Sharded Cluster; 22.4 Creating Incremental Backups with mongooplog; Chapter 23: Deploying MongoDB; 23.1 Designing the System; 23.2 Virtualization; 23.3 Configuring System Settings; 23.4 Configuring Your Network; 23.5 System Housekeeping; Installing MongoDB; Choosing a Version; Windows Install; POSIX (Linux, Mac OS X, and Solaris) Install; MongoDB Internals; BSON; Wire Protocol; Data Files; Namespaces and Extents; Memory-Mapped Storage Engine; Colophon;