You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/01/28 16:08:43 UTC

[GitHub] [couchdb] vmatyusGitHub opened a new issue #2496: Query all document (_all_docs) from specific partition with filtering returns wrong total_rows value and document information

vmatyusGitHub opened a new issue #2496: Query all document (_all_docs) from specific partition with filtering returns wrong total_rows value and document information
URL: https://github.com/apache/couchdb/issues/2496
 
 
   [NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )
   
   ## Description
   
   [NOTE]: # ( Describe the problem you're encountering. )
   [TIP]:  # ( Do NOT give us access or passwords to your actual CouchDB! )
   During the usage of `POST /{db}/_partition/{partition_key}/_all_docs` in the response there is a field `total_rows` and its value should return the number of documents in the shard range hosting that partition.
   Furthermore it should return only partition specific documents.
   
   If there is `keys` filter included in the query, currently the request returns the number of documents in the database and all partition related document that matches with the filter. There is no partition filtering.
   
   ## Steps to Reproduce
   [NOTE]: # ( Include commands to reproduce, if possible. curl is preferred. )
   1. Create a partitioned database
   2. Create sample partitioned documents
   3. Query the database with endpoint: `POST /{db}/_partition/{partition_key}/_all_docs --data-raw {}` It shall return a `total_rows` value. Let's call it `n`. 
   Returns all partition specific document.
   4. Query the database with an additional filter. eg: `POST /{db}/_partition/part2/_all_docs --data-raw {"keys":["part1:doc1", "part2:doc1"]}`
   In this case the `total_rows` of the response contains the number of all document of the database . 
   
   In the request the following can be seen:
   ```
   "rows": [
           {
               "id": "part1:doc1",
               "key": "part1:doc1",
               "value": {
                   "rev": "5-aa9d2b82de6db1e61fba8e4057299d21"
               }
           },
           {
               "id": "part2:doc1",
               "key": "part2:doc1",
               "value": {
                   "rev": "3-a707bb62c86bd430389e4d596aeb6084"
               }
           }
   ]
   ```
   
   
   ## Expected Behaviour
   The `total_rows` field should have value  `n`.
   Only partition specific document information should be returned.
   This should be the expected response:
   ```
   "rows": [
           {
               "key": "part1:doc1",
               "error": "not_found"
           },
           "id": "part2:doc1",
               "key": "part2:doc1",
               "value": {
                   "rev": "3-a707bb62c86bd430389e4d596aeb6084"
               }
       ]
   ```
   [NOTE]: # ( Tell us what you expected to happen. )
   
   ## Your Environment
   
   [TIP]:  # ( Include as many relevant details about your environment as possible. )
   [TIP]:  # ( You can paste the output of curl http://YOUR-COUCHDB:5984/ here. )
   
   * CouchDB version used: CouchDB 3.0.0-6d432a9
   * Browser name and version: PostMan 7.15.0
   * Operating system and version: MacOS desktop Catalina 10.15.2
   
   ## Additional Context
   
   [TIP]:  # ( Add any other context about the problem here. )
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services