Free Sample
+ Collection

MongoDB Cookbook

Amol Nayak

Over 80 practical recipes to design, deploy, and administer MongoDB
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782161943
Paperback388 pages

About This Book

  • Gain a thorough understanding of some of the key features of MongoDB
  • Learn the techniques necessary to solve frequent MongoDB problems
  • Packed full of step-by-step recipes to help you with installation, design, and deployment

Who This Book Is For

If you want a reference to show you practical solutions, or just want to satisfy your need for more knowledge of this fantastic NoSQL database, then this book is ideal for you. To get the most out of this book, you should know the basics of MongoDB.

Table of Contents

Chapter 1: Installing and Starting the MongoDB Server
Single node installation of MongoDB
Starting a single node instance using command-line options
Single node installation of MongoDB with options from the config file
Connecting to a single node from the Mongo shell with a preloaded JavaScript
Connecting to a single node from a Java client
Starting multiple instances as part of a replica set
Connecting to the replica set from the shell to query and insert data
Connecting to the replica set to query and insert data from a Java client
Starting a simple sharded environment of two shards
Connecting to a shard from the Mongo shell and performing operations
Chapter 2: Command-line Operations and Indexes
Creating test data
Performing simple querying, projections, and pagination from the Mongo shell
Updating and deleting data from the shell
Creating an index and viewing plans of queries
Background and foreground index creation from the shell
Creating unique indexes on collection and deleting the existing duplicate data automatically
Creating and understanding sparse indexes
Expiring documents after a fixed interval using the TTL index
Expiring documents at a given time using the TTL index
Chapter 3: Programming Language Drivers
Installing PyMongo
Executing query and insert operations using PyMongo
Executing update and delete operations using PyMongo
Aggregation in Mongo using PyMongo
MapReduce in Mongo using PyMongo
Executing query and insert operations using a Java client
Executing update and delete operations using a Java client
Aggregation in Mongo using a Java client
MapReduce in Mongo using a Java client
Chapter 4: Administration
Renaming a collection
Viewing collection stats
Viewing database stats
Disabling the preallocation of data files
Manually padding a document
Understanding the mongostat and mongotop utilities
Estimating the working set
Viewing and killing the currently executing operations
Using profiler to profile operations
Setting up users in MongoDB
Understanding interprocess security in MongoDB
Modifying collection behavior using the collMod command
Setting up MongoDB as a Windows Service
Configuring a replica set
Stepping down as a primary instance from the replica set
Exploring the local database of a replica set
Understanding and analyzing oplogs
Building tagged replica sets
Configuring the default shard for nonsharded collections
Manually splitting and migrating chunks
Performing domain-driven sharding using tags
Exploring the config database in a sharded setup
Chapter 5: Advanced Operations
Atomic find and modify operations
Implementing atomic counters in MongoDB
Implementing server-side scripts
Creating and tailing capped collection cursors in MongoDB
Converting a normal collection to a capped collection
Storing binary data in MongoDB
Storing large data in MongoDB using GridFS
Storing data to GridFS from a Java client
Storing data to GridFS from a Python client
Implementing triggers in MongoDB using oplog
Executing flat plane (2D) geospatial queries in Mongo using geospatial indexes
Spherical indexes and GeoJSON-compliant data in MongoDB
Implementing a full-text search in MongoDB
Integrating MongoDB with Elasticsearch for a full-text search
Chapter 6: Monitoring and Backups
Signing up for MMS and setting up the MMS monitoring agent
Managing users and groups on the MMS console
Monitoring MongoDB instances on MMS
Setting up monitoring alerts on MMS
Backing up and restoring data in Mongo using out-of-the box tools
Configuring the MMS backup service
Managing backups in the MMS backup service
Chapter 7: Cloud Deployment on MongoDB
Setting up and managing the MongoLab account
Setting up a sandbox MongoDB instance on MongoLab
Performing operations on MongoDB from MongoLab GUI
Setting up MongoDB on Amazon EC2 using the MongoDB AMI
Setting up MongoDB on Amazon EC2 without using the MongoDB AMI
Chapter 8: Integration with Hadoop
Executing our first sample MapReduce job using the mongo-hadoop connector
Writing our first Hadoop MapReduce job
Running MapReduce jobs on Hadoop using streaming
Running a MapReduce job on Amazon EMR
Chapter 9: Open Source and Proprietary Tools
Developing using spring-data-mongodb
Accessing MongoDB using Java Persistence API
Accessing MongoDB over REST
Installing the GUI-based client, MongoVUE, for 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

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.


Read More

Recommended for You