Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Tim Hawkins, Eelco Plugge, Peter Membrey, David Hows
The Definitive Guide to MongoDB: A complete guide to dealing with Big Data using MongoDB, Third Edition
Cover
Title
Copyright
Dedication
Contents at a Glance
Contents
About the Authors
About the Technical Reviewer
About the Contributor
Acknowledgments
Introduction
Chapter 1 : Introduction to MongoDB
Reviewing the MongoDB Philosophy
Using the Right Tool for the Right Job
Lacking Innate Support for Transactions
JSON and MongoDB
Adopting a Nonrelational Approach
Opting for Performance vs. Features
Running the Database Anywhere
Fitting Everything Together
Generating or Creating a Key
Using Keys and Values
Implementing Collections
Understanding Databases
Reviewing the Feature List
WiredTiger
Using Document-Oriented Storage (BSON)
Supporting Dynamic Queries
Indexing Your Documents
Leveraging Geospatial Indexes
Profiling Queries
Updating Information In Place (Memory Mapped Database Only)
Storing Binary Data
Replicating Data
Implementing Sharding
Using Map and Reduce Functions
The Aggregation Framework
Getting Help
Visiting the Website
Cutting and Pasting MongoDB Code
Finding Solutions on Google Groups
Finding Solutions on Stack Overflow
Leveraging the JIRA Tracking System
Chatting with the MongoDB Developers
Summary
Chapter 2 : Installing MongoDB
Choosing Your Version
Understanding the Version Numbers
Installing MongoDB on Your System
Installing MongoDB under Linux
Installing MongoDB under Windows
Running MongoDB
Prerequisites
Surveying the Installation Layout
Using the MongoDB Shell
Installing Additional Drivers
Installing the PHP Driver
Confirming That Your PHP Installation Works
Installing the Python Driver
Confirming That Your PyMongo Installation Works
Summary
Chapter 3 : The Data Model
Designing the Database
Drilling Down on Collections
Using Documents
Creating the _id Field
Building Indexes
Impacting Performance with Indexes
Implementing Geospatial Indexing
Querying Geospatial Information
Pluggable Storage Engines
Using MongoDB in the Real World
Summary
Chapter 4 : Working with Data
Navigating Your Databases
Viewing Available Databases and Collections
Inserting Data into Collections
Querying for Data
Using the Dot Notation
Using the Sort, Limit, and Skip Functions
Working with Capped Collections, Natural Order, and $natural
Retrieving a Single Document
Using the Aggregation Commands
Working with Conditional Operators
Leveraging Regular Expressions
Updating Data
Updating with update()
Implementing an Upsert with the save() Command
Updating Information Automatically
Removing Elements from an Array
Specifying the Position of a Matched Array
Atomic Operations
Modifying and Returning a Document Atomically
Processing Data in Bulk
Executing Bulk Operations
Evaluating the Output
Renaming a Collection
Deleting Data
Referencing a Database
Referencing Data Manually
Referencing Data with DBRef
Implementing Index-Related Functions
Surveying Index-Related Commands
Summary
Chapter 5 : GridFS
Filling in Some Background
Working with GridFS
Getting Started with the Command-Line Tools
Using the _id Key
Working with Filenames
The File’s Length
Working with Chunk Sizes
Tracking the Upload Date
Hashing Your Files
Looking Under MongoDB’s Hood
Using the search Command
Deleting
Retrieving Files from MongoDB
Summing Up mongofiles
Exploiting the Power of Python
Connecting to the Database
Accessing the Words
Putting Files into MongoDB
Retrieving Files from GridFS
Deleting Files
Summary
Chapter 6 : PHP and MongoDB
Comparing Documents in MongoDB and PHP
MongoDB Classes
Connecting and Disconnecting
Inserting Data
Listing Your Data
Returning a Single Document
Listing All Documents
Using Query Operators
Querying for Specific Information
Sorting, Limiting, and Skipping Items
Counting the Number of Matching Results
Grouping Data with the Aggregation Framework
Specifying the Index with Hint
Refining Queries with Conditional Operators
Determining Whether a Field Has a Value
Regular Expressions
Modifying Data with PHP
Updating via update()
Saving Time with Update Operators
Upserting Data with save()
Modifying a Document Atomically
Processing Data in Bulk
Executing Bulk Operations
Evaluating the Output
Deleting Data
DBRef
Retrieving the Information
GridFS and the PHP Driver
Storing Files
Adding More Metadata to Stored Files
Retrieving Files
Deleting Data
Summary
Chapter 7 : Python and MongoDB
Working with Documents in Python
Using PyMongo Modules
Connecting and Disconnecting
Inserting Data
Finding Your Data
Finding a Single Document
Finding Multiple Documents
Using Dot Notation
Returning Fields
Simplifying Queries with sort(), limit(), and skip()
Aggregating Queries
Specifying an Index with hint()
Refining Queries with Conditional Operators
Conducting Searches with Regular Expressions
Modifying the Data
Updating Your Data
Modifier Operators
Replacing Documents with replace_one()
Modifying a Document Atomically
Putting the Parameters to Work
Processing Data in Bulk
Executing Bulk Operations
Deleting Data
Creating a Link Between Two Documents
Retrieving the Information
Summary
Chapter 8 : Advanced Queries
Text Search
Text Search Costs and Limitations
Using Text Search
Text Indexes in Other Languages
Compound Indexing with Text Indexes
The Aggregation Framework
Using the $group Command
Using the $limit Operator
Using the $match Operator
Using the $sort Operator
Using the $unwind Operator
Using the $skip Operator
Using the $out Operator
Using the $lookup Operator
MapReduce
How MapReduce Works
Setting Up Testing Documents
Working with Map Functions
Advanced MapReduce
Debugging MapReduce
Summary
Chapter 9 : Database Administration
Using Administrative Tools
mongo, the MongoDB Console
Using Third-Party Administration Tools
Backing Up the MongoDB Server
Creating a Backup 101
Backing Up a Single Database
Backing Up a Single Collection
Digging Deeper into Backups
Restoring Individual Databases or Collections
Restoring a Single Database
Restoring a Single Collection
Automating Backups
Using a Local Datastore
Using a Remote (Cloud-Based) Datastore
Backing Up Large Databases
Using a Hidden Secondary Server for Backups
Creating Snapshots with a Journaling Filesystem
Disk Layout to Use with Volume Managers
Importing Data into MongoDB
Exporting Data from MongoDB
Securing Your Data by Restricting Access to a MongoDB Server
Protecting Your Server with Authentication
Adding an Admin User
Enabling Authentication
Authenticating in the mongo Console
MongoDB User Roles
Changing a User’s Credentials
Adding a Read-Only User
Deleting a User
Using Authenticated Connections in a PHP Application
Managing Servers
Starting a Server
Getting the Server’s Version
Getting the Server’s Status
Shutting Down a Server
Using MongoDB Log Files
Validating and Repairing Your Data
Repairing a Server
Validating a Single Collection
Repairing Collection Validation Faults
Repairing a Collection’s Data Files
Compacting a Collection’s Data Files
Upgrading MongoDB
Rolling Upgrade of MongoDB
Monitoring MongoDB
Using MongoDB Cloud Manager
Summary
Chapter 10 : Optimization
Optimizing Your Server Hardware for Performance
Understanding MongoDB’s Storage Engines
Understanding MongoDB Memory Use Under MMAPv1
Understanding Working Set Size in MMAPv1
Understanding MongoDB Memory Use Under WiredTiger
Compression in WiredTiger
Choosing the Right Database Server Hardware
Evaluating Query Performance
The MongoDB Profiler
Analyzing a Specific Query with explain()
Using the Profiler and explain() to Optimize a Query
Managing Indexes
Listing Indexes
Creating a Simple Index
Creating a Compound Index
Three-Step Compound Indexes By A. Jesse Jiryu Davis
The Setup
Range Query
Equality Plus Range Query
Digression: How MongoDB Chooses an Index
Equality, Range Query, and Sort
Final Method
Specifying Index Options
Creating an Index in the Background with {background:true}
Creating an Index with a Unique Key {unique:true}
Creating Sparse Indexes with {sparse:true}
Creating Partial Indexes
TTL Indexes
Text Search Indexes
Dropping an Index
Reindexing a Collection
Using hint( ) to Force Using a Specific Index
Using Index Filters
Optimizing the Storage of Small Objects
Summary
Chapter 11 : Replication
Spelling Out MongoDB’s Replication Goals
Improving Scalability
Improving Durability/Reliability
Providing Isolation
Replication Fundamentals
What Is a Primary?
What Is a Secondary?
What Is an Arbiter?
Drilling Down on the Oplog
Implementing a Replica Set
Creating a Replica Set
Getting a Replica Set Member Up and Running
Adding a Server to a Replica Set
Adding an Arbiter
Replica Set Chaining
Managing Replica Sets
Configuring the Options for Replica Set Members
Connecting to a Replica Set from Your Application
Read Concern
Summary
Chapter 12 : Sharding
Exploring the Need for Sharding
Partitioning Horizontal and Vertical Data
Partitioning Data Vertically
Partitioning Data Horizontally
Analyzing a Simple Sharding Scenario
Implementing Sharding with MongoDB
Setting Up a Sharding Configuration
Determining How You’re Connected
Listing the Status of a Sharded Cluster
Using Replica Sets to Implement Shards
The Balancer
Hashed Shard Keys
Tag Sharding
Adding More Config Servers
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Title
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset