You are previewing Pro MongoDB™ Development.
O'Reilly logo
Pro MongoDB™ Development

Book Description

Pro MongoDB Development is a critical reference for anyone using MongoDB, a NoSQL database based on the BSON (binary JSON) document model. The book explores many aspects of implementing MongoDB in web applications, whether you are using Java, PHP, Ruby, and JavaScript. Noted expert Deepak Vohra walks you through accessing MongoDB databases with all these languages and working with various other technologies and databases.

Vohra discusses using Java EE frameworks Kundera and Spring Data with MongoDB. You learn the nuts and bolts of migrating data from other NoSQL databases (Apache Cassandra and Couchbase) and from relational databases (Oracle Database). And, because NoSQL databases are commonly used with the Hadoop ecosystem, the book also covers using MongoDB with Apache Hive. Each chapter includes details about the software you need and hands on examples of working with MongoDB and these technologies so you know exactly what to do, whatever your MongoDB implementation requires.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Contents at a Glance
  5. Contents
  6. About the Author
  7. About the Technical Reviewers
  8. Introduction
  9. Chapter 1: Using a Java Client with MongoDB
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Creating a BSON Document
    4. Using a Model to Create a BSON Document
    5. Getting Data from MongoDB
    6. Updating Data in MongoDB
    7. Deleting Data in MongoDB
    8. Summary
  10. Chapter 2: Using the Mongo Shell
    1. Getting Started
      1. Setting Up the Environment
      2. Starting the Mongo Shell
      3. Running a Command or Method in Mongo Shell
    2. Using Databases
      1. Getting Databases Information
      2. Creating a Database Instance
      3. Dropping a Database
    3. Using Collections
      1. Creating a Collection
      2. Dropping a Collection
    4. Using Documents
      1. Adding a Document
      2. Adding a Batch of Documents
      3. Saving a Document
      4. Updating a Document
      5. Updating Multiple Documents
      6. Finding One Document
      7. Finding All Documents
      8. Finding Selected Fields
      9. Using the Cursor
      10. Finding and Modifying a Document
      11. Removing a Document
    5. Summary
  11. Chapter 3: Using MongoDB with PHP
    1. Getting Started
      1. Overview of the PHP MongoDB Database Driver
      2. Setting Up the Environment
      3. Installing PHP
      4. Installing PHP Driver for MongoDB
      5. Creating a Connection
      6. Getting Database Info
    2. Using Collections
      1. Getting a Collection
      2. Dropping a Collection
      3. Using Documents
      4. Adding a Document
      5. Adding Multiple Documents
      6. Adding a Batch of Documents
      7. Finding a Single Document
      8. Finding All Documents
      9. Finding a Subset of Fields and Documents
      10. Updating a Document
      11. Updating Multiple Documents
      12. Saving a Document
      13. Removing a Document
    3. Summary
  12. Chapter 4: Using MongoDB with Ruby
    1. Getting Started
      1. Overview of the Ruby Driver for MongoDB
      2. Setting Up the Environment
      3. Installing Ruby
      4. Installing DevKit
      5. Installing Ruby Driver for MongoDB
    2. Using a Collection
      1. Creating a Connection with MongoDB
      2. Connecting to a Database
      3. Creating a Collection
    3. Using Documents
      1. Adding a Document
      2. Adding Multiple Documents
      3. Finding a Single Document
      4. Finding Multiple Documents
      5. Updating Documents
      6. Deleting Documents
      7. Performing Bulk Operations
    4. Summary
  13. Chapter 5: Using MongoDB with Node.js
    1. Getting Started
      1. Overview of Node.js Driver for MongoDB
      2. Setting Up the Environment
      3. Installing MongoDB Server
      4. Installing Node.js
      5. Installing the Node.js Driver for MongoDB
    2. Using a Connection
      1. Creating a MongoDB Connection
      2. Using the Database
      3. Using a Collection
    3. Using Documents
      1. Adding a Single Document
      2. Adding Multiple Documents
      3. Finding a Single Document
      4. Finding All Documents
      5. Finding a Subset of Documents
      6. Using the Cursor
      7. Finding and Modifying a Single Document
      8. Finding and Removing a Single Document
      9. Replacing a Single Document
      10. Updating a Single Document
      11. Updating Multiple Documents
      12. Removing a Single Document
      13. Removing Multiple Documents
      14. Performing Bulk Write Operations
    4. Summary
  14. Chapter 6: Migrating an Apache Cassandra Table to MongoDB
    1. Setting Up the Environment
    2. Creating a Maven Project in Eclipse
    3. Creating a Document in Apache Cassandra
    4. Migrating the Cassandra Table to MongoDB
    5. Summary
  15. Chapter 7: Migrating Couchbase to MongoDB
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Creating Java Classes
    4. Configuring the Maven Project
    5. Adding Documents to Couchbase
    6. Creating a Couchbase View
    7. Migrating Couchbase Documents to MongoDB
    8. Summary
  16. Chapter 8: Migrating Oracle Database
    1. Overview of the mongoimport Tool
    2. Setting Up the Environment
    3. Creating an Oracle Database Table
    4. Exporting an Oracle Database Table to a CSV File
    5. Importing Data from a CSV File to MongoDB
    6. Displaying the JSON Data in MongoDB
    7. Summary
  17. Chapter 9: Using Kundera with MongoDB
    1. Setting Up the Environment
    2. Creating a MongoDB Collection
    3. Creating a Maven Project in Eclipse
    4. Creating a JPA Entity Class
    5. Configuring JPA in the persistence.xml Configuration File
    6. Creating a JPA Client Class
    7. Running CRUD Operations
      1. Creating a Catalog
      2. Finding a Catalog Entry Using the Entity Class
      3. Finding a Catalog Entry Using a JPA Query
      4. Updating a Catalog Entry
      5. Deleting a Catalog Entry
    8. The Kundera-Mongo JPA Client Class
      1. Installing the Maven Project
      2. Running the Kundera-Mongo JPA Client Class
      3. Invoking the KunderaClient Methods
    9. Summary
  18. Chapter 10: Using Spring Data with MongoDB
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Installing Spring Data MongoDB
    4. Configuring JavaConfig
    5. Creating a Model
    6. Using Spring Data MongoDB with Template
      1. Creating a MongoDB Collection
      2. Creating Document Instances
      3. Adding a Document
      4. Adding a Document Batch
      5. Finding a Document by Id
      6. Finding One Document
      7. Finding All Documents
      8. Finding Documents Using a Query
      9. Updating the First Document
      10. Update Multiple Documents
      11. Removing Documents
    7. Using Spring Data with MongoDB
      1. Getting Document Count
      2. Finding Entities from Repository
      3. Saving Entities
      4. Deleting Entities
      5. Deleting a Document By Id
      6. Deleting All Documents
    8. Summary
  19. Chapter 11: Creating an Apache Hive Table with MongoDB
    1. Overview of Hive Storage Handler for MongoDB
    2. Setting Up the Environment
    3. Creating a MongoDB Data Store
    4. Creating an External Table in Hive
    5. Summary
  20. Chapter 12: Integrating MongoDB with Oracle Database in Oracle Data Integrator
    1. Setting Up the Environment
    2. Creating the Physical Architecture
    3. Creating the Logical Architecture
    4. Creating the Data Models
    5. Creating the Integration Project
    6. Creating the Integration Interface
    7. Running the Interface
    8. Selecting Integrated Data in Oracle Database Table
    9. Summary
  21. Index