6.2.1. Attachments

If the document includes attachments, then the returned structure will contain a summary of the attachments associatd with the document, but not the attachment data itself.

The JSON for the returned document will include the _attachments field, with one or more attachment definitions. For example:

{
   "_id" : "FishStew",
   "servings" : 4,
   "subtitle" : "Delicious with fresh bread",
   "title" : "Fish Stew"
   "_attachments" : {
      "styling.css" : {
         "stub" : true,
         "content-type" : "text/css",
         "length" : 783426,
         },
   },
}

The format of the returned JSON is shown in the table below:

Table 6.4.  Returned Document with Attachments

FieldDescription
_id (optional) Document ID
_rev (optional) Revision ID (when updating an existing document)
_attachments (optional) Document Attachment
        filename Attachment
                content_type MIME Content type string
                length Length (bytes) of the attachment data
                revpos Revision where this attachment exists
                stub Indicates whether the attachment is a stub