dharders opened a new issue #969: GET /db/_all_docs?update_seq=true missing 
'offset' and 'update_seq' when 'keys' also provided
URL: https://github.com/apache/couchdb/issues/969
 
 
   <!--- Provide a general summary of the issue in the Title above -->
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   A `GET /db/_all_docs?update_seq=true&keys=["aValidKey"]` should return 
   ```javascript
   {
     total_rows: X,
     rows: [{id: "aValidKey", ...}],
     offset: Y,
     update_seq: "Z-ABC..."
   }
   ```
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   Instead it returns
   ```javascript
   {
     total_rows: X,
     rows: [{id: "aValidKey", ...}]
   }
   ```
   i.e. it is **missing 'offset' and 'update_seq'** when 'keys' also provided.
   
   **NOTE:** this is also true for `POST`
   
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   Specifying `key` instead of `keys` produces the desired behavior so possibly 
check that code path
   
   i.e.  `GET /db/_all_docs?update_seq=true&key="aValidKey"` works as expected
   
   ## Steps to Reproduce (for bugs)
   <!--- Provide a link to a live example, or an unambiguous set of steps to -->
   <!--- reproduce this bug. Include code to reproduce, if relevant -->
   1. 
   ```javascript
    curl -X PUT "localhost:5984/testdb"
   ```
   2. 
   ```javascript
   curl -X POST -H "Content-Type: application/json" -d '{"docs": [{"_id": 
"doc1"}, {"_id": "doc2"}]}' "localhost:5984/testdb/_bulk_docs"
   ```
   3.
   ```javascript
   curl -X GET 'localhost:5984/testdb/_all_docs?update_seq=true&keys=\["doc1"\]'
   ```
   4. Response is missing `offset` and `update_seq`
   5. Below response is as expected when using `key` instead of `keys`
   ```javascript
   curl -X GET 'localhost:5984/testdb/_all_docs?update_seq=true&key="doc1"'
   ```
   6. Response should contain `offset` and `update_seq` as expected
   7. POST is also not returning `offset` and `update_seq`
   ```javascript
   curl -X POST -H "Content-Type: application/json" -d '{"keys": ["doc1"]}' 
'localhost:5984/testdb/_all_docs?update_seq=true'
   ```
   ## Context
   <!--- How has this issue affected you? What are you trying to accomplish? -->
   <!--- Providing context helps us come up with a solution that is most useful 
in the real world -->
   Noticed this bug when putting together a PR to add a feature to PouchDB (see 
[PouchDB issue 6230](https://github.com/pouchdb/pouchdb/issues/6230), i.e. 
missing `update_seq` option in allDocs API)
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced 
the bug in -->
   * Version used: CouchDB v2.1.0
   * Browser Name and version: curl, Chrome 61.0.3163.100 (Official Build) 
(64-bit)
   * Operating System and version (desktop or mobile): Windows 10 64-bit Desktop
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to