Sumário Itens Encontrados: 195About the AuthorChapter 1: Using a Java Client with MongoDB 1Setting Up the Environment 1Creating a Maven Project 2Creating a BSON Document 11Using a Model to Create a BSON Document 16Getting Data from MongoDB 22Updating Data in MongoDB 26Deleting Data in MongoDB 32Summary 37Chapter 2: Using the Mongo Shell 39Getting Started 39Setting Up the Environment 39Starting the Mongo Shell 40Running a Command or Method in Mongo Shell 42Using Databases 44Getting Databases Information 44Creating a Database Instance 46Dropping a Database 47viUsing Collections 48Creating a Collection 48Dropping a Collection 52Using Documents 53Adding a Document 53Adding a Batch of Documents 56Saving a Document 60Updating a Document 68Updating Multiple Documents 71Finding One Document 74Finding All Documents 75Finding Selected Fields 76Using the Cursor 80Finding and Modifying a Document 82Removing a Document 85Summary 87Chapter 3: Using MongoDB with PHP 89Getting Started 89Overview of the PHP MongoDB Database Driver 89Setting Up the Environment 91Installing PHP 92Installing PHP Driver for MongoDB 93Creating a Connection 94Getting Database Info 97Using Collections 98Getting a Collection 99Dropping a Collection 101Using Documents 102Adding a Document 102Adding Multiple Documents 106Adding a Batch of Documents 107viiFinding a Single Document 110Finding All Documents 112Finding a Subset of Fields and Documents 114Updating a Document 117Updating Multiple Documents 120Saving a Document 122Removing a Document 125Summary 128Chapter 4: Using MongoDB with Ruby 129Getting Started 129Overview of the Ruby Driver for MongoDB 129Setting Up the Environment 131Installing Ruby 131Installing DevKit 133Installing Ruby Driver for MongoDB 134Using a Collection 136Creating a Connection with MongoDB 136Connecting to a Database 139Creating a Collection 143Using Documents 147Adding a Document 147Adding Multiple Documents 151Finding a Single Document 156Finding Multiple Documents 158Updating Documents 162Deleting Documents 169Performing Bulk Operations 173Summary 176Chapter 5: Using MongoDB with Node.js 177Getting Started 177Overview of Node.js Driver for MongoDB 177Setting Up the Environment 178Installing MongoDB Server 178Installing Node.js 178Installing the Node.js Driver for MongoDB 185Using a Connection 186Creating a MongoDB Connection 186Using the Database 191Using a Collection 198Using Documents 205Adding a Single Document 205Adding Multiple Documents 208Finding a Single Document 210Finding All Documents 213Finding a Subset of Documents 215Using the Cursor 217Finding and Modifying a Single Document 221Finding and Removing a Single Document 224Replacing a Single Document 227Updating a Single Document 229Updating Multiple Documents 233Removing a Single Document 235Removing Multiple Documents 237Performing Bulk Write Operations 239Summary 242ixChapter 6: Migrating an Apache Cassandra Table to MongoDB 243Setting Up the Environment 243Creating a Maven Project in Eclipse 245Creating a Document in Apache Cassandra 255Migrating the Cassandra Table to MongoDB 263Summary 272Chapter 7: Migrating Couchbase to MongoDB 273Setting Up the Environment 273Creating a Maven Project 274Creating Java Classes 278Configuring the Maven Project 281Adding Documents to Couchbase 283Creating a Couchbase View 288Migrating Couchbase Documents to MongoDB 292Summary 296Chapter 8: Migrating Oracle Database 297Overview of the mongoimport Tool 297Setting Up the Environment 298Creating an Oracle Database Table 299Exporting an Oracle Database Table to a CSV File 299Importing Data from a CSV File to MongoDB 301Displaying the JSON Data in MongoDB 302Summary 304Chapter 9: Using Kundera with MongoDB 305Setting Up the Environment 306Creating a MongoDB Collection 306Creating a Maven Project in Eclipse 307Creating a JPA Entity Class 312xConfiguring JPA in the persistence.xml Configuration File 318Creating a JPA Client Class 325Running CRUD Operations 327Creating a Catalog 328Finding a Catalog Entry Using the Entity Class 328Finding a Catalog Entry Using a JPA Query 329Updating a Catalog Entry 330Deleting a Catalog Entry 330The Kundera-Mongo JPA Client Class 331Installing the Maven Project 333Running the Kundera-Mongo JPA Client Class 338Invoking the KunderaClient Methods 339Summary 343Chapter 10: Using Spring Data with MongoDB 345Setting Up the Environment 345Creating a Maven Project 346Installing Spring Data MongoDB 350Configuring JavaConfig 351Creating a Model 353Using Spring Data MongoDB with Template 354Creating a MongoDB Collection 356Creating Document Instances 358Adding a Document 358Adding a Document Batch 361Finding a Document by Id 363Finding One Document 364Finding All Documents 368Finding Documents Using a Query 370xiUpdating the First Document 373Update Multiple Documents 376Removing Documents 379Using Spring Data with MongoDB 389Getting Document Count 391Finding Entities from Repository 392Saving Entities 395Deleting Entities 399Deleting a Document By Id 399Deleting All Documents 400Summary 404Chapter 11: Creating an Apache Hive Table with MongoDB 405Overview of Hive Storage Handler for MongoDB 405Setting Up the Environment 406Creating a MongoDB Data Store 409Creating an External Table in Hive 422Summary 426 Chapter 12: Integrating MongoDB with Oracle Database in OracleData Integrator 427Setting Up the Environment 427Creating the Physical Architecture 430Creating the Logical Architecture 443Creating the Data Models 447Creating the Integration Project 459Creating the Integration Interface 464Running the Interface 470Selecting Integrated Data in Oracle Database Table 476Summary 476Index 477