The following appendix provides a quick reference to all the JSON structures that you can supply to CouchDB, or get in return to requests.
Table A.1. JSON Structures
Table A.2. All Database Documents
Field | Description |
offset | Offset where the document list started |
rows [array] | Array of document object |
total_rows | Number of documents in the database/view |
update_seq (optional) | Current update sequence for the database |
Table A.3. Bulk Document Response
Field | Description |
docs [array] | Bulk Docs Returned Documents |
error | Error type |
id | Document ID |
reason | Error string with extended reason |
Table A.4. Bulk Documents
Field | Description |
all_or_nothing (optional) | Sets the database commit mode to use all-or-nothing semantics |
docs [array] | Bulk Documents Document |
_id (optional) | Document ID |
_rev (optional) | Revision ID (when updating an existing document) |
_deleted (optional) | Whether the document should be deleted |
Table A.5. Changes information for a database
Field | Description |
last_seq | Last change sequence number |
results [array] | Changes made to a database |
changes [array] | List of changes, field-by-field, for this document |
id | Document ID |
seq | Update sequence number |
Table A.6. CouchDB Document
Field | Description |
_id (optional) | Document ID |
_rev (optional) | Revision ID (when updating an existing document) |
Table A.7. CouchDB Error Status
Field | Description |
error | Error type |
id | Document ID |
reason | Error string with extended reason |
Table A.8. CouchDB database information object
Field | Description |
committed_update_seq | The number of committed update. |
compact_running | Set to true if the database compaction routine is operating on this database. |
db_name | The name of the database. |
disk_format_version | The version of the physical format used for the data when it is stored on disk. |
disk_size | Size in bytes of the data as stored on the disk. Views indexes are not included in the calculation. |
doc_count | A count of the documents in the specified database. |
doc_del_count | Number of deleted documents |
instance_start_time | Timestamp of when the database was created, expressed in milliseconds since the epoch. |
purge_seq | The number of purge operations on the database. |
update_seq | The current number of updates to the database. |
Table A.9. Design Document
Field | Description |
_id | Design Document ID |
_rev | Design Document Revision |
views | View |
viewname | View Definition |
map | Map Function for View |
reduce (optional) | Reduce Function for View |
Table A.10. Design Document Information
Field | Description |
name | Name/ID of Design Document |
view_index | View Index |
compact_running | Indicates whether a compaction routine is currently running on the view |
disk_size | Size in bytes of the view as stored on disk |
language | Language for the defined views |
purge_seq | The purge sequence that has been processed |
signature | MD5 signature of the views for the design document |
update_seq | The update sequence of the corresponding database that has been indexed |
updater_running | Indicates if the view is currently being updated |
waiting_clients | Number of clients waiting on views from this design document |
waiting_commit | Indicates if there are outstanding commits to the underlying database that need to processed |
Table A.11. Design Document spatial index Information
Field | Description |
name | Name/ID of Design Document |
spatial_index | View Index |
compact_running | Indicates whether a compaction routine is currently running on the view |
disk_size | Size in bytes of the view as stored on disk |
language | Language for the defined views |
purge_seq | The purge sequence that has been processed |
signature | MD5 signature of the views for the design document |
update_seq | The update sequence of the corresponding database that has been indexed |
updater_running | Indicates if the view is currently being updated |
waiting_clients | Number of clients waiting on views from this design document |
waiting_commit | Indicates if there are outstanding commits to the underlying database that need to processed |
Table A.12. Document with Attachments
Field | Description |
_id (optional) | Document ID |
_rev (optional) | Revision ID (when updating an existing document) |
_attachments (optional) | Document Attachment |
filename | Attachment information |
content_type | MIME Content type string |
data | File attachment content, Base64 encoded |
Table A.13. List of Active Tasks
Field | Description |
tasks [array] | Active Task |
pid | Process ID |
status | Task status message |
task | Task name |
type | Operation Type |
Table A.14. Replication Settings
Field | Description |
cancel (optional) | Cancels the replication |
continuous (optional) | Configure the replication to be continuous |
create_target (optional) | Creates the target database |
doc_ids (optional) | Array of document IDs to be synchronized |
proxy (optional) | Address of a proxy server through which replication should occur |
source | Source database name or URL |
target | Target database name or URL |
Table A.15. Replication Status
Field | Description |
history [array] | Replication History |
doc_write_failures | Number of document write failures |
docs_read | Number of documents read |
docs_written | Number of documents written to target |
end_last_seq | Last sequence number in changes stream |
end_time | Date/Time replication operation completed |
missing_checked | Number of missing documents checked |
missing_found | Number of missing documents found |
recorded_seq | Last recorded sequence number |
session_id | Session ID for this replication operation |
start_last_seq | First sequence number in changes stream |
start_time | Date/Time replication operation started |
ok | Replication status |
session_id | Unique session ID |
source_last_seq | Last sequence number read from source database |
Table A.16. Returned CouchDB Document with Detailed Revision Info
Field | Description |
_id (optional) | Document ID |
_rev (optional) | Revision ID (when updating an existing document) |
_revs_info [array] | CouchDB Document Extended Revision Info |
rev | Full revision string |
status | Status of the revision |
Table A.17. Returned CouchDB Document with Revision Info
Field | Description |
_id (optional) | Document ID |
_rev (optional) | Revision ID (when updating an existing document) |
_revisions | CouchDB Document Revisions |
ids [array] | Array of valid revision IDs, in reverse order (latest first) |
start | Prefix number for the latest revision |
Table A.18. Returned Document with Attachments
Field | Description |
_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 |
Table A.19. Security Object
Field | Description |
admins | Roles/Users with admin privileges |
roles [array] | List of roles with parent privilege |
users [array] | List of users with parent privilege |
readers | Roles/Users with reader privileges |
roles [array] | List of roles with parent privilege |
users [array] | List of users with parent privilege |