content_image/675687.jpg
Write Operations Overview (page 74) Provides an overview of MongoDB’s data insertion and modification opera- tions, including aspects of the syntax, and behavior. 

Write Concern (page 78) Describes the kind of guarantee MongoDB provides when reporting on the success of a write operation. 

Atomicity and Transactions (page 80) Describes write operation atomicity in MongoDB. 

Distributed Write Operations (page 82) Describes how MongoDB directs write operations on sharded clusters and replica sets and the performance characteristics of these operations. 

Write Operation Performance (page 86) Introduces the performance constraints and factors for writing data to Mon- goDB deployments. 

Bulk Write Operations (page 87) Provides an overview of MongoDB’s bulk write operations. 

Storage (page 89) Introduces the storage allocation strategies available for MongoDB collections. 

## Write Operations Overview 

A write operation is any operation that creates or modifies data in the MongoDB instance. In MongoDB, write operations target a single collection . All write operations in MongoDB are atomic on the level of a single document . 

There are three classes of write operations in MongoDB: insert (page 74), update (page 75), and remove (page 77). Insert operations add new data to a collection. Update operations modify existing data, and remove operations delete data from a collection. No insert, update, or remove can affect more than one document atomically. 

For the update and remove operations, you can specify criteria, or conditions, that identify the documents to update or remove. These operations use the same query syntax to specify the criteria as read operations (page 60). 

MongoDB allows applications to determine the acceptable level of acknowledgement required of write operations. See Write Concern (page 78) for more information. 

## Insert 

In MongoDB, the db.collection.insert() method adds new documents to a collection. 

The following diagram highlights the components of a MongoDB insert operation: 

<img src='content_image/675687.jpg'>

The following diagram shows the same query in SQL: 

## Example 

