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 2019/08/27 11:12:15 UTC

[GitHub] [couchdb] jlami opened a new issue #2145: duplicate entries in keys gives incorrect order

jlami opened a new issue #2145: duplicate entries in keys gives incorrect order
URL: https://github.com/apache/couchdb/issues/2145
 
 
   ## Description
   
   When querying a custom view with duplicate entries in the `keys` parameter the output will be ordered incorrectly.
   _all_docs works correctly and so does Cloudant apparantly (did not test that myself), but custom view does not keep the order given in `keys`
   
   ## Steps to Reproduce
   
   View:
   ```json
   {
   "_id": "_design/personen",
   "_rev": "6-a0208565e54d1d300dcee98f489ae15b",
   "views": {
   "actief": {
   "map": "function (doc) {\n  if (doc._id.substr(0, \"persoon_2_\".length) == \"persoon_2_\" && doc.data && doc.data.actief) {\n    emit(doc._id.substr(\"persoon_2_\".length), 1);\n  }\n}"
   }
   },
   "language": "javascript"
   }
   ```
   
   `curl -gi 'http://server:5984/db/_design/personen/_view/actief?keys=[%2210003%22,%2210002%22,%2210003%22]'`
   ```
   Cache-Control: must-revalidate
   Content-Type: application/json
   Date: Tue, 27 Aug 2019 10:26:34 GMT
   Server: CouchDB/2.3.1 (Erlang OTP/19)
   Transfer-Encoding: chunked
   X-Couch-Request-ID: 98e58c6382
   X-CouchDB-Body-Time: 0
    
   {"total_rows":13933,"offset":2,"rows":[
   {"id":"persoon_2_10002","key":"10002","value":1},
   {"id":"persoon_2_10003","key":"10003","value":1},
   {"id":"persoon_2_10003","key":"10003","value":1}
   ```
   
   ## Expected Behaviour
   Order should be same as the input to `keys`
   ```{"total_rows":13933,"offset":2,"rows":[
   {"id":"persoon_2_10003","key":"10003","value":1},
   {"id":"persoon_2_10002","key":"10002","value":1},
   {"id":"persoon_2_10003","key":"10003","value":1}
   ```
   
   ## Your Environment
   
   Tested on Windows with 2.2.0 and 2.3.1 and on Linux with 2.3.1
   
   ## Additional context
   
   Discussed with @rnewson on (web)irc, who could reproduce it locally but not on Cloudant
   https://gist.github.com/rnewson/14a8175a295017ddf5d772331ea445c5
   

----------------------------------------------------------------
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