Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Mobile 3.0
-
None
-
0
Description
Problem
There's an issue with the Changes feed documentation for limit. As per the documentation for GET or POST /db/_changes REST API,
Using a value of 0 has the same effect as the value 1.
However, this is incorrect:
- limit = 1 means return 1 result in response.
- limit = 0 means that no limit is applied.
Request
- Could you please fix this in both GET and POST /db/_changes REST APIs?
Reproduction
When limit=1 is used only 1 result was returned in response.
# curl -X GET "http://localhost:4985/neurodev/_changes?since=0&limit=1&include_docs=true&feed=normal&active_only=false" -H "Authorization: Basic $DIGEST" -H "accept: application/json" -H "Content-Type: application/javascript" |
{"results":[ |
{"seq":2,"id":"test","doc":{"Name":"Yuvraj","_id":"test","_rev":"2-2b5f91420485cae5431383df98c90b5e","age":29},"changes":[{"rev":"2-2b5f91420485cae5431383df98c90b5e"}]} |
],
|
"last_seq":"2"} |
# curl -X GET "http://localhost:4985/neurodev/_changes?since=0&limit=1&include_docs=true&feed=normal&active_only=true" -H "Authorization: Basic $DIGEST" -H "accept: application/json" -H "Content-Type: application/javascript" |
{"results":[ |
{"seq":2,"id":"test","doc":{"Name":"Yuvraj","_id":"test","_rev":"2-2b5f91420485cae5431383df98c90b5e","age":29},"changes":[{"rev":"2-2b5f91420485cae5431383df98c90b5e"}]} |
],
|
"last_seq":"2"} |
When limit=0 is used more than 1 results i.e. with no limit are returned:
# curl -X GET "http://localhost:4985/neurodev/_changes?since=0&limit=0&include_docs=true&feed=normal&active_only=false" -H "Authorization: Basic $DIGEST" -H "accept: application/json" -H "Content-Type: application/javascript" |
{"results":[ |
{"seq":2,"id":"test","doc":{"Name":"Yuvraj","_id":"test","_rev":"2-2b5f91420485cae5431383df98c90b5e","age":29},"changes":[{"rev":"2-2b5f91420485cae5431383df98c90b5e"}]} |
,{"seq":3,"id":"test1","doc":{"Name":"Arvinder","_id":"test1","_rev":"1-f5334ceecf9e5f238ba7193a75b75b21","age":25},"changes":[{"rev":"1-f5334ceecf9e5f238ba7193a75b75b21"}]} |
],
|
"last_seq":"3"} |
# curl -X GET "http://localhost:4985/neurodev/_changes?since=0&limit=0&include_docs=true&feed=normal&active_only=true" -H "Authorization: Basic $DIGEST" -H "accept: application/json" -H "Content-Type: application/javascript" |
{"results":[ |
{"seq":2,"id":"test","doc":{"Name":"Yuvraj","_id":"test","_rev":"2-2b5f91420485cae5431383df98c90b5e","age":29},"changes":[{"rev":"2-2b5f91420485cae5431383df98c90b5e"}]} |
,{"seq":3,"id":"test1","doc":{"Name":"Arvinder","_id":"test1","_rev":"1-f5334ceecf9e5f238ba7193a75b75b21","age":25},"changes":[{"rev":"1-f5334ceecf9e5f238ba7193a75b75b21"}]} |
],
|
"last_seq":"3"} |