MongoDB CRUD operations
In this section, we will cover CRUD operations while using Ruby, Python, and PHP with the official MongoDB driver and some popular frameworks for each language, respectively.
CRUD using the Ruby driver
In Chapter 3, MongoDB CRUD Operations, we covered how to connect to MongoDB from Ruby, Python, and PHP using the respective drivers and object document mapping (ODM). In this chapter, we will explore the create
, read
, update
, and delete
 operations while using the official drivers and the most commonly used ODM frameworks.
Creating documents
Using the process described in Chapter 2, Schema Design and Data Modeling, we assume that we have an @collection
 instance variable pointing to our books
 collection in a mongo_book
 database in the 127.0.0.1:27017
 default database:
@collection = Mongo::Client.new...