The JSON returned by the _bulk_docs
operation
consists of an array of JSON structures, one for each document
in the original submission. The returned JSON structure should
be examined to ensure that all of the documents submitted in the
original request were successfully added to the database.
The exact structure of the returned information is shown in Table 5.6, “ Bulk Document Response ”.
Table 5.6. Bulk Document Response
Field | Description |
docs [array] | Bulk Docs Returned Documents |
error | Error type |
id | Document ID |
reason | Error string with extended reason |
When a document (or document revision) is not correctly comitted
to the database because of an error, you should check the
error
field to determine error type and
course of action. Errors will be one of the following type:
conflict
The document as submitted is in conflict. If you used the
default bulk transaction mode then the new revision will not
have been created and you will need to re-submit the
document to the database. If you used
all-or-nothing
mode then you will need to
manually resolve the conflicted revisions of the document.
Conflict resolution of documents added using the bulk docs interface is identical to the resolution procedures used when resolving conflict errors during replication.
forbidden
Entries with this error type indicate that the validation routine applied to the document during submission has returned an error.
For example, if your validation routine includes the following:
throw({forbidden: 'invalid recipe ingredient'});
The error returned will be:
{ "id" : "7f7638c86173eb440b8890839ff35433", "error" : "forbidden", "reason" : "invalid recipe ingredient" }
For more information, see ???.