0%

Book Description

Over 80 practical recipes to design, deploy, and administer MongoDB

In Detail

MongoDB is a high-performance and feature-rich NoSQL database that forms the backbone of numerous complex development systems. You will certainly find the MongoDB solution you are searching for in this book.

Starting with how to initialize the server in three different modes with various configurations, you will then learn a variety of skills including the basics of advanced query operations and features in MongoDB and monitoring and backup using MMS. From there, you can delve into recipes on cloud deployment, integration with Hadoop, and improving developer productivity. By the end of this book, you will have a clear idea about how to design, develop, and deploy MongoDB.

What You Will Learn

  • Install, configure, and start MongoDB
  • Interact with the MongoDB server and perform various basic to advanced query operations from the shell
  • Take an in-depth look at the MongoDB programming driver APIs in Java and Python
  • Perform cloud deployment and introduce managed MongoDB services
  • Integrate with Hadoop using Hadoop connector and run MapReduce jobs
  • Discover frameworks and products built to improve developer productivity using MongoDB

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. MongoDB Cookbook
    1. Table of Contents
    2. MongoDB Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Installing and Starting the MongoDB Server
      1. Introduction
      2. Single node installation of MongoDB
        1. Getting ready
        2. How to do it…
        3. There's more...
        4. See also
      3. Starting a single node instance using command-line options
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Single node installation of MongoDB with options from the config file
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Connecting to a single node from the Mongo shell with a preloaded JavaScript
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more...
      6. Connecting to a single node from a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Starting multiple instances as part of a replica set
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Connecting to the replica set from the shell to query and insert data
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      9. Connecting to the replica set to query and insert data from a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
      10. Starting a simple sharded environment of two shards
        1. Getting ready
        2. How to do it…
        3. How it works
        4. There's more…
      11. Connecting to a shard from the Mongo shell and performing operations
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
    9. 2. Command-line Operations and Indexes
      1. Creating test data
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      2. Performing simple querying, projections, and pagination from the Mongo shell
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Updating and deleting data from the shell
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Creating an index and viewing plans of queries
        1. Getting ready
        2. How to do it…
        3. How it works…
          1. Analyzing the plan
          2. Improving the query execution time
          3. Improvement using indexes
          4. Improvement using covered indexes
          5. Some gotchas of index creation
      5. Background and foreground index creation from the shell
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Creating unique indexes on collection and deleting the existing duplicate data automatically
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Creating and understanding sparse indexes
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Expiring documents after a fixed interval using the TTL index
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      9. Expiring documents at a given time using the TTL index
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
    10. 3. Programming Language Drivers
      1. Introduction
      2. Installing PyMongo
        1. Getting ready
        2. How to do it…
        3. There's more…
      3. Executing query and insert operations using PyMongo
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Executing update and delete operations using PyMongo
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Aggregation in Mongo using PyMongo
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. MapReduce in Mongo using PyMongo
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Executing query and insert operations using a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Executing update and delete operations using a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      9. Aggregation in Mongo using a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
      10. MapReduce in Mongo using a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    11. 4. Administration
      1. Renaming a collection
        1. Getting ready
        2. How to do it…
        3. How it works…
      2. Viewing collection stats
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Viewing database stats
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Disabling the preallocation of data files
        1. How to do it…
      5. Manually padding a document
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Understanding the mongostat and mongotop utilities
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Estimating the working set
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Viewing and killing the currently executing operations
        1. Getting ready
        2. How to do it…
        3. How it works…
      9. Using profiler to profile operations
        1. Getting ready
        2. How to do it…
        3. How it works…
      10. Setting up users in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      11. Understanding interprocess security in MongoDB
        1. Getting ready
        2. How to do it…
        3. There's more…
      12. Modifying collection behavior using the collMod command
        1. Getting ready
        2. How to do it…
        3. How it works…
      13. Setting up MongoDB as a Windows Service
        1. Getting ready
        2. How to do it…
      14. Configuring a replica set
        1. Getting ready
          1. Elections in a replica set
          2. Basic configuration for a replica set
        2. How to do it…
        3. How it works…
          1. A replica set member as an arbiter
          2. Priority of replica set members
          3. Hidden, votes, slave delayed, and build index configurations
        4. There's more…
      15. Stepping down as a primary instance from the replica set
        1. Getting ready
        2. How to do it…
        3. How it works…
      16. Exploring the local database of a replica set
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      17. Understanding and analyzing oplogs
        1. Getting ready
        2. How to do it…
        3. How it works…
      18. Building tagged replica sets
        1. Getting ready
        2. How to do it…
        3. How it works…
          1. WriteConcern in tagged replica sets
          2. ReadPreference in tagged replica sets
      19. Configuring the default shard for nonsharded collections
        1. Getting ready
        2. How to do it…
        3. How it works…
      20. Manually splitting and migrating chunks
        1. Getting ready
        2. How to do it…
        3. How it works…
      21. Performing domain-driven sharding using tags
        1. Getting ready
        2. How to do it…
        3. How it works…
      22. Exploring the config database in a sharded setup
        1. Getting ready
        2. How to do it…
        3. How it works…
    12. 5. Advanced Operations
      1. Introduction
      2. Atomic find and modify operations
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Implementing atomic counters in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Implementing server-side scripts
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Creating and tailing capped collection cursors in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Converting a normal collection to a capped collection
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Storing binary data in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Storing large data in MongoDB using GridFS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Storing data to GridFS from a Java client
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      10. Storing data to GridFS from a Python client
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      11. Implementing triggers in MongoDB using oplog
        1. Getting ready
        2. How to do it…
        3. How it works…
      12. Executing flat plane (2D) geospatial queries in Mongo using geospatial indexes
        1. Getting ready
        2. How to do it…
        3. How it works…
      13. Spherical indexes and GeoJSON-compliant data in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
      14. Implementing a full-text search in MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      15. Integrating MongoDB with Elasticsearch for a full-text search
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    13. 6. Monitoring and Backups
      1. Introduction
      2. Signing up for MMS and setting up the MMS monitoring agent
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Managing users and groups on the MMS console
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Monitoring MongoDB instances on MMS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Setting up monitoring alerts on MMS
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Backing up and restoring data in Mongo using out-of-the box tools
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Configuring the MMS backup service
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Managing backups in the MMS backup service
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    14. 7. Cloud Deployment on MongoDB
      1. Introduction
      2. Setting up and managing the MongoLab account
        1. How to do it…
        2. How it works…
      3. Setting up a sandbox MongoDB instance on MongoLab
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Performing operations on MongoDB from MongoLab GUI
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Setting up MongoDB on Amazon EC2 using the MongoDB AMI
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Setting up MongoDB on Amazon EC2 without using the MongoDB AMI
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    15. 8. Integration with Hadoop
      1. Introduction
      2. Executing our first sample MapReduce job using the mongo-hadoop connector
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Writing our first Hadoop MapReduce job
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Running MapReduce jobs on Hadoop using streaming
        1. Getting ready
        2. How it works…
        3. How to do it…
      5. Running a MapReduce job on Amazon EMR
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    16. 9. Open Source and Proprietary Tools
      1. Introduction
      2. Developing using spring-data-mongodb
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Accessing MongoDB using Java Persistence API
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Accessing MongoDB over REST
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Installing the GUI-based client, MongoVUE, for MongoDB
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
    17. A. Concepts for Reference
      1. Write concern and its significance
        1. Setting up a replica set
      2. Read preference for querying
        1. Knowing the internals
    18. Index