eiri opened a new issue #1100: End point `/db/_design_docs` doesn't respect query parameters URL: https://github.com/apache/couchdb/issues/1100 New end point `/db/_design_docs` doesn't respect number of `_all_docs` query parameters. ## Expected Behavior End-point `/db/_design_docs` should support query parameters `descending`, `end_key`, `inclusive_end`, `limit` and `key` in the same as `/db/_all_docs` ## Current Behavior 1. `descending` outputs an empty "rows" 1. `end_key` doesn't respect default `inclusive_end` 1. `end_key` doesn't respect `limit` 1. `inclusive_end` set to `false` ignores `end_key` 1. `key` returns an empty "rows" ## Possible Solution `/db/_design_docs` implemented as a patch on top of `_all_docs` functionality and needs 1) proper javascript tests 2) rework for a full functionality. ## Steps to Reproduce (for bugs) This is going to be a bit lengthy. HTTP client used: [httpie](https://httpie.org) 0.9.8 with [jq](https://stedolan.github.io/jq/) ### Setup Run dev cluster ``` $ ./dev/run ... [ * ] Developers cluster is set up at http://127.0.0.1:15984. Admin username: root Password: XXXXXXXX Time to hack! ... ``` Create db ``` $ http put :15984/koi { "ok": true } ``` Add 5 docs changing key from "a" to "g" ``` $ http post :15984/koi key=a { "id": "c1fd637ab339c0dd839b483fd8000fe0", "ok": true, "rev": "1-f443804e079279645227a179f7e373cf" } ... ``` Add 5 ddocs changing name from "ddoc01" to "ddoc05" ``` $ http put :15984/koi/_design/ddoc01 views:='{"keys":{"map":"function(doc) { emit(doc.key); }"}}' { "id": "_design/ddoc01", "ok": true, "rev": "1-a09c1f1ecbbb13a6fd553f3bf8e8a497" } ... ``` Confirm we have all the docs ``` $ http :15984/koi/_all_docs | jq .rows[].id "_design/ddoc01" "_design/ddoc02" "_design/ddoc03" "_design/ddoc04" "_design/ddoc05" "c1fd637ab339c0dd839b483fd8000fe0" "c1fd637ab339c0dd839b483fd8001fa2" "c1fd637ab339c0dd839b483fd80023f8" "c1fd637ab339c0dd839b483fd80026a0" "c1fd637ab339c0dd839b483fd80028ca" "c1fd637ab339c0dd839b483fd8003633" "c1fd637ab339c0dd839b483fd80045cb" ``` ### Baseline Confirm that plain `_design_docs` works ``` $ http :15984/koi/_design_docs | jq .rows[].id "_design/ddoc01" "_design/ddoc02" "_design/ddoc03" "_design/ddoc04" "_design/ddoc05" ``` ### Bugs #### Check `descending` ``` $ http :15984/koi/_design_docs descending==true { "offset": 12, "rows": [], "total_rows": 12 } ``` Suppose to have reverse order ddocs in rows #### Check `end_key` ``` $ http :15984/koi/_design_docs end_key=='"_design/ddoc02"' | jq .rows[].id "_design/ddoc01" ``` Suppose to include _design/ddoc02 as default for `inclusive_end` is true Check `end_key` with explicit `inclusive_end` ``` $ http :15984/koi/_design_docs endkey=='"_design/ddoc02"' inclusive_end==true | jq .rows[].id "_design/ddoc01" ``` Same story. #### Check `end_key` with `limit` ``` $ http :15984/koi/_design_docs endkey=='"_design/ddoc05"' limit=2 | jq .rows[].id "_design/ddoc01" "_design/ddoc02" "_design/ddoc03" "_design/ddoc04" ``` Suppose to stop at "_design/ddoc02" #### Check `inclusive_end` ``` $ http :15984/koi/_design_docs endkey=='"_design/ddoc02"' inclusive_end==false | jq .rows[].id "_design/ddoc01" "_design/ddoc02" "_design/ddoc03" "_design/ddoc04" "_design/ddoc05" ``` Suppose to return only first two docs, but actually turns off `end_key` completely #### Check "key" ``` $ http :15984/koi/_design_docs key=='"_design/ddoc03"' { "offset": 2, "rows": [], "total_rows": 12 } ``` Suppose to actually return document, not just show its offset, e.g. ``` $ http :15984/koi/_all_docs key=='"_design/ddoc03"' { "offset": 2, "rows": [ { "id": "_design/ddoc03", "key": "_design/ddoc03", "value": { "rev": "1-a09c1f1ecbbb13a6fd553f3bf8e8a497" } } ], "total_rows": 12 } ``` _Sidenote_: `keys` actually works ``` $ http :15984/koi/_design_docs keys=='["_design/ddoc03"]' | jq .rows[].id "_design/ddoc03" $ http :15984/koi/_design_docs keys=='["_design/ddoc05", "_design/ddoc03"]' | jq .rows[].id "_design/ddoc05" "_design/ddoc03" ``` ## Context New end-point need to be actually working before presented as a feature. Ref: apache/couchdb-documentation#229 ## Your Environment * Version used: `65fbcd01c (HEAD -> master, origin/master, origin/HEAD` * Browser Name and version: httpie 0.9.8 * Operating System and version (desktop or mobile): 17.3.0 Darwin
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
