5.9.3. Bulk Documents Transaction Semantics

CouchDB supports two different modes for updating (or inserting) documents using the bulk documentation system. Each mode affects both the state of the documents in the event of system failure, and the level of conflict checking performed on each document. The two modes are:

The effects of different database operations on the different modes are summarized in the table below:

Table 5.5. Conflicts on Bulk Inserts

Transaction Mode Transaction Cause Resolution
Non-atomic Insert Requested document ID already exists Resubmit with different document ID, or update the existing document
Non-atomic Update Revision missing or incorrect Resubmit with correct revision
All-or-nothing Insert Additional revision inserted Resolve conflicted revisions
All-or-nothing Update Additional revision inserted Resolve conflicted revisions

Replication of documents is independent of the type of insert or update. The documents and revisions created during a bulk insert or update are replicated in the same way as any other document. This can mean that if you make use of the all-or-nothing mode the exact list of documents, revisions (and their conflict state) may or may not be replicated to other databases correctly.