You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/04/10 16:21:13 UTC
[couchdb] branch main updated: docs: Fixed `_compact/{ddoc}` and `_shards/{docid}` examples
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new 1432717b1 docs: Fixed `_compact/{ddoc}` and `_shards/{docid}` examples
1432717b1 is described below
commit 1432717b154e2986e86da18c78ca843e020a5bfd
Author: jiahuili <li...@gmail.com>
AuthorDate: Fri Apr 7 11:24:18 2023 -0500
docs: Fixed `_compact/{ddoc}` and `_shards/{docid}` examples
- Modified the example and add a `manual view compaction` link to the
api `/{db}/_compact/{ddoc}` to facilitate users to view `_compact`
related documents.
- Fixed example request for GET /{db}/_shards/{docid}
---
src/docs/src/api/database/compact.rst | 4 ++--
src/docs/src/api/database/shard.rst | 9 +++------
src/docs/src/maintenance/compaction.rst | 19 +++++++++++++++++--
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/src/docs/src/api/database/compact.rst b/src/docs/src/api/database/compact.rst
index 8d81d5023..ecd82b930 100644
--- a/src/docs/src/api/database/compact.rst
+++ b/src/docs/src/api/database/compact.rst
@@ -94,7 +94,7 @@
It may be that compacting a large view can return more storage than
compacting the actual db. Thus, you can use this in place of the full
database compaction if you know a specific set of view indexes have been
- affected by a recent database change.
+ affected by a recent database change. See :ref:`compact/views` for details.
:param db: Database name
:param ddoc: Design document name
@@ -114,7 +114,7 @@
.. code-block:: http
- POST /db/_compact/posts HTTP/1.1
+ POST /db/_compact/ddoc HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:5984
diff --git a/src/docs/src/api/database/shard.rst b/src/docs/src/api/database/shard.rst
index 1b923240d..b9c196608 100644
--- a/src/docs/src/api/database/shard.rst
+++ b/src/docs/src/api/database/shard.rst
@@ -132,12 +132,9 @@
.. code-block:: http
- HTTP/1.1 200 OK
- Cache-Control: must-revalidate
- Content-Length: 94
- Content-Type: application/json
- Date: Fri, 18 Jan 2019 20:08:07 GMT
- Server: CouchDB/2.3.0-9d4cb03c2 (Erlang OTP/19)
+ GET /db/_shards/docid HTTP/1.1
+ Accept: */*
+ Host: localhost:5984
**Response**:
diff --git a/src/docs/src/maintenance/compaction.rst b/src/docs/src/maintenance/compaction.rst
index 6f8b44349..de44cc4f7 100644
--- a/src/docs/src/maintenance/compaction.rst
+++ b/src/docs/src/maintenance/compaction.rst
@@ -334,9 +334,24 @@ Manual View Compaction
Views also need compaction. Unlike databases, views are compacted by groups
per `design document`. To start their compaction, send the HTTP
-:post:`/{db}/_compact/{ddoc}` request::
+:post:`/{db}/_compact/{ddoc}` request:
- curl -H "Content-Type: application/json" -X POST http://localhost:5984/dbname/_compact/designname
+**Design Document**:
+
+.. code-block:: json
+
+ {
+ "_id": "_design/ddoc-name",
+ "views": {
+ "view-name": {
+ "map": "function(doc) { emit(doc.key, doc.value) }"
+ }
+ }
+ }
+
+.. code-block:: bash
+
+ curl -H "Content-Type: application/json" -X POST http://localhost:5984/dbname/_compact/ddoc-name
.. code-block:: javascript