1.5.1. /db/_design/design-doc

Returns the HTTP Headers containing a minimal amount of information about the specified design document.

See also

GET /{db}/_design/{ddoc}

Returns the contents of the design document specified with the name of the design document and from the specified database from the URL. Unless you request a specific revision, the latest revision of the document will always be returned.

See also

GET /{db}/{docid}

PUT /{db}/_design/{ddoc}

The method creates a new named design document, or creates a new revision of the existing design document.

The design documents have some agreement upon their fields and structure. Currently it is the following:

  • language (string): Defines Query Server to process design document functions

  • options (object): View’s default options

  • filters (object): definition

  • lists (object): List functions definition. Deprecated.

  • rewrites (array or string): Rewrite rules definition. Deprecated.

  • shows (object): definition. Deprecated.

  • updates (object): Update functions definition

  • validate_doc_update (string): function source

  • views (object): View functions definition.

  • autoupdate (boolean): Indicates whether to automatically build indexes defined in this design document. Default is true.

Note, that for filters, lists, shows and updates fields objects are mapping of function name to string function source code. For views mapping is the same except that values are objects with map and reduce (optional) keys which also contains functions source code.

See also

DELETE /{db}/_design/{ddoc}

Deletes the specified document from the database. You must supply the current (latest) revision, either by using the parameter to specify the revision.

DELETE /{db}/{docid}

COPY /{db}/_design/{ddoc}

The (which is non-standard HTTP) copies an existing design document to a new or existing one.

Given that view indexes on disk are named after their MD5 hash of the view definition, and that a COPY operation won’t actually change that definition, the copied views won’t have to be reconstructed. Both views will be served from the same index on disk.

See also

COPY /{db}/{docid}

1.5.2. /db/_design/design-doc/attachment

HEAD /{db}/_design/{ddoc}/{attname}

Returns the HTTP headers containing a minimal amount of information about the specified attachment.

See also

HEAD /{db}/{docid}/{attname}

GET /{db}/_design/{ddoc}/{attname}

Returns the file attachment associated with the design document. The raw data of the associated attachment is returned (just as if you were accessing a static file.

See also

PUT /{db}/_design/{ddoc}/{attname}

Uploads the supplied content as an attachment to the specified design document. The attachment name provided must be a URL encoded string.

See also

PUT /{db}/{docid}/{attname}

DELETE /{db}/_design/{ddoc}/{attname}

Deletes the attachment of the specified design document.

See also

1.5.3. /db/_design/design-doc/_info

GET /{db}/_design/{ddoc}/_info

Obtains information about the specified design document, including the index, index size and current status of the design document and associated index information.

  • Parameters

    • ddoc – Design document name

    Request Headers

      • application/json

      • text/plain

    Response Headers

    Response JSON Object

    Status Codes

    • – Request completed successfully

Request:

Response:

  1. HTTP/1.1 200 OK
  2. Cache-Control: must-revalidate
  3. Content-Length: 263
  4. Content-Type: application/json
  5. Date: Sat, 17 Aug 2013 12:54:17 GMT
  6. {
  7. "name": "recipe",
  8. "view_index": {
  9. "compact_running": false,
  10. "language": "python",
  11. "purge_seq": 0,
  12. "signature": "a59a1bb13fdf8a8a584bc477919c97ac",
  13. "active": 926691,
  14. "disk": 1982704,
  15. "external": 1535701
  16. },
  17. "update_seq": 12397,
  18. "updater_running": false,
  19. "waiting_clients": 0,
  20. "waiting_commit": false
  21. }
  22. }

The response from GET /{db}/_design/{ddoc}/_info contains (object) field with the next structure:

  • compact_running (boolean): Indicates whether a compaction routine is currently running on the view

  • sizes.active (number): The size of live data inside the view, in bytes

  • sizes.external (number): The uncompressed size of view contents in bytes

  • sizes.file (number): Size in bytes of the view as stored on disk

  • language (string): Language for the defined views

  • purge_seq (number): The purge sequence that has been processed

  • signature (string): MD5 signature of the views for the design document

  • update_seq (number / string): The update sequence of the corresponding database that has been indexed

  • updater_running (boolean): Indicates if the view is currently being updated

  • waiting_commit (boolean): Indicates if there are outstanding commits to the underlying database that need to processed