O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

MongoDB: The Definitive Guide, 3rd Edition

Book Description

With Early Release ebooks, you get books in their earliest form—the author's raw and unedited content as he or she writes—so you can take advantage of these technologies long before the official release of these titles. You’ll also receive updates when significant changes are made, new chapters are available, and the final ebook bundle is released.

Manage your data in a database system designed to support modern application development. The updated edition of this authoritative and accessible guide shows you the many advantages of using document-oriented databases, including how this secure, high-performance system enables flexible data models, high availability, and horizontal scalability.

Written by current and former members of the MongoDB team, the third edition covers new features introduced in MongoDB versions 3.0 and 3.2, and includes a preview of 3.4 features. You’ll find substantial updates on querying, indexing, aggregation, replica sets, cloud and ops manager, test setup, sharding administration, data administration, durability, monitoring, and security.

Authors Shannon Bradshaw (MongoDB) and Kristina Chodorow (Google) provide guidance for database developers, advanced configuration for system administrators, and use cases for a variety of projects. Ideal for NoSQL newcomers and experienced MongoDB users alike, this book also includes many real-world schema design examples.

Table of Contents

  1. 1. Introduction
    1. Ease of Use
    2. Designed to Scale
    3. Rich with Features...
    4. …Without Sacrificing Speed
    5. Let’s Get Started
  2. I. Introduction to MongoDB
  3. 2. Getting Started
    1. Documents
    2. Collections
      1. Dynamic Schemas
      2. Naming
    3. Databases
    4. Getting and Starting MongoDB
    5. Introduction to the MongoDB Shell
      1. Running the Shell
      2. A MongoDB Client
      3. Basic Operations with the Shell
    6. Data Types
      1. Basic Data Types
      2. Dates
      3. Arrays
      4. Embedded Documents
      5. _id and ObjectIds
    7. Using the MongoDB Shell
      1. Tips for Using the Shell
      2. Running Scripts with the Shell
      3. Creating a .mongorc.js
      4. Customizing Your Prompt
      5. Editing Complex Variables
      6. Inconvenient Collection Names
  4. 3. Creating, Updating, and Deleting Documents
    1. Inserting Documents
      1. insertMany()
      2. Insert Validation
      3. insert()
    2. Removing Documents
      1. drop()
    3. Updating Documents
      1. Document Replacement
      2. Using Update Operators
      3. Upserts
      4. Updating Multiple Documents
      5. Returning Updated Documents
  5. 4. Querying
    1. Introduction to find
      1. Specifying Which Keys to Return
      2. Limitations
    2. Query Criteria
      1. Query Conditionals
      2. OR Queries
      3. $not
      4. Conditional Semantics
    3. Type-Specific Queries
      1. null
      2. Regular Expressions
      3. Querying Arrays
      4. Querying on Embedded Documents
    4. $where Queries
      1. Server-Side Scripting
    5. Cursors
      1. Limits, Skips, and Sorts
      2. Avoiding Large Skips
      3. Advanced Query Options
      4. Immortal Cursors
    6. Database Commands
      1. How Commands Work
  6. 5. Indexes
    1. Introduction to Indexes
      1. Creating an Index
      2. Introduction to Compound Indexes
      3. How MongoDB Selects an Index
      4. Using Compound Indexes
      5. How $-Operators Use Indexes
      6. Indexing Objects and Arrays
      7. Index Cardinality
    2. Using explain()
      1. The Query Optimizer
    3. When Not to Index
    4. Types of Indexes
      1. Unique Indexes
      2. Sparse Indexes
    5. Index Administration
      1. Identifying Indexes
      2. Changing Indexes
  7. 6. Special Index and Collection Types
    1. Geospatial Indexes
      1. Types of Geospatial Queries
      2. Using Geospatial Indexes
      3. Compound Geospatial Indexes
      4. 2D Indexes
    2. Indexes for Full Text Search
      1. Create a Text Index
      2. Text Search
      3. Optimize Full Text Search
      4. Searching in Other Languages
    3. Capped Collections
      1. Creating Capped Collections
      2. Tailable Cursors
    4. Time-To-Live (TTL) Indexes
    5. Storing Files with GridFS
      1. Getting Started with GridFS: mongofiles
      2. Working with GridFS from the MongoDB Drivers
      3. Under the Hood