While the durability assurance provided by the journal typically outweigh the performance costs of the additional write operations, consider the following interactions between the journal and performance: 

• if the journal and the data file reside on the same block device, the data files and the journal may have to contend for a finite number of available write operations. Moving the journal to a separate device may increase the capacity for write operations. 

• if applications specify write concern (page 78) that includes journaled (page 80), mongod will decrease the duration between journal commits, which can increases the overall write load. 

• the duration between journal commits is configurable using the commitIntervalMs run-time option. De- creasing the period between journal commits will increase the number of write operations, which can limit MongoDB’s capacity for write operations. Increasing the amount of time between commits may decrease the total number of write operation, but also increases the chance that the journal will not record a write operation in the event of a failure. 

For additional information on journaling, see Journaling Mechanics (page 308). 

## Bulk Write Operations 

## Overview 

MongoDB provides clients the ability to perform write operations in bulk. Bulk write operations affect a single collection. MongoDB allows applications to determine the acceptable level of acknowledgement required for bulk write operations. 

New Bulk methods provide the ability to perform bulk insert, update, and remove operations. MongoDB also supports bulk insert through passing an array of documents to the db.collection.insert() method. 

Changed in version 2.6: Previous versions of MongoDB provided the ability for bulk inserts only. With previous versions, clients could perform bulk inserts by passing an array of documents to the db.collection.insert() 7 method. To see the documentation for earlier versions, see Bulk Inserts$^{8}$. 

## Ordered vs Unordered Operations 

Bulk write operations can be either ordered or unordered . With an ordered list of operations, MongoDB executes the operations serially. If an error occurs during the processing of one of the write operations, MongoDB will return without processing any remaining write operations in the list. 

With an unordered list of operations, MongoDB can execute the operations in parallel. If an error occurs during the processing of one of the write operations, MongoDB will continue to process remaining write operations in the list. 

Executing an ordered list of operations on a sharded collection will generally be slower than executing an unordered list since with an ordered list, each operation must wait for the previous operation to finish. 

## Bulk Methods 

To use the Bulk() methods: 

1. Initialize a list of operations using either db.collection.initializeUnorderedBulkOp() or db.collection.initializeOrderedBulkOp() . 

2. Add write operations to the list using the following methods: 

