[ https://issues.apache.org/jira/browse/COUCHDB-3239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15725235#comment-15725235 ]
Will Holley commented on COUCHDB-3239: -------------------------------------- Thanks [~paul.joseph.davis]. This isn't breaking anything as far as I know - it just stood out as an implicit change between 1.6 and 2.0 when I was adding latest=true support to PouchDB and trying to figure out how Couch behaved. There is an issue with PouchDB failing to sync correctly against CouchDB 2.0 when conflicts are present but I've yet to get to the bottom of it. My assumption was that open_revs behaved similarly to other bulk API calls (_bulk_docs, _bulk_get, etc) and the response would contains results in the order of the request parameters. It's fine if that's not the case but probably something we should document. > incorrect ordering of results when using open_revs and latest=true > ------------------------------------------------------------------ > > Key: COUCHDB-3239 > URL: https://issues.apache.org/jira/browse/COUCHDB-3239 > Project: CouchDB > Issue Type: Bug > Components: Database Core > Affects Versions: 2.0.0 > Reporter: Will Holley > Attachments: docs.json > > > When fetching open_revs with latest=true for a conflicted document, the order > of results is incorrect. For example, if I create a document with the rev > tree: > {code} > 4-d1 > / > 3-c1 > / > 2-b1 > / > 1-a > \ > 2-b2 > \ > 3-c2 > {code} > and ask for {{open_revs=["2-b1","2-b2"]&latest=true}}, the response will > return {{3-c2}} followed by {{4-d1}} - the reverse of what I'd expect. > Below is a test/reproduction executed against Couch 1.6.1 and 2.0. > 1.6.1: > {code} > $ export COUCH_HOST="http://127.0.0.1:5984" > $ curl -XPUT "$COUCH_HOST/open_revs_test" > {"ok":true} > $ curl "$COUCH_HOST/open_revs_test/_bulk_docs" -H > "Content-Type:application/json" -XPOST -d @docs.json > [] > # GET open_revs=["2-b1","2-b2"] > $ curl -H "Accept:application/json" > "$COUCH_HOST/open_revs_test/mydoc?open_revs=%5B%222-b1%22%2C%222-b2%22%5D" > [{"ok":{"_id":"mydoc","_rev":"2-b1","value":"x-winning"}},{"ok":{"_id":"mydoc","_rev":"2-b2","value":"x-losing"}}] > # GET open_revs=["2-b1","2-b2"]&latest=true > $ curl -H "Accept:application/json" > "$COUCH_HOST/open_revs_test/mydoc?open_revs=%5B%222-b1%22%2C%222-b2%22%5D&latest=true" > [{"ok":{"_id":"mydoc","_rev":"4-d1","value":"z-winning"}},{"ok":{"_id":"mydoc","_rev":"3-c2","value":"y-losing"}}] > {code} > 2.0: > {code} > $ export COUCH_HOST="http://127.0.0.1:15984" > $ curl -XPUT "$COUCH_HOST/open_revs_test" > {"ok":true} > $ curl "$COUCH_HOST/open_revs_test/_bulk_docs" -H > "Content-Type:application/json" -XPOST -d @docs.json > [] > # GET open_revs=["2-b1","2-b2"] > $ curl -H "Accept:application/json" > "$COUCH_HOST/open_revs_test/mydoc?open_revs=%5B%222-b1%22%2C%222-b2%22%5D" > [{"ok":{"_id":"mydoc","_rev":"2-b1","value":"x-winning"}},{"ok":{"_id":"mydoc","_rev":"2-b2","value":"x-losing"}}] > # GET open_revs=["2-b1","2-b2"]&latest=true > $ curl -H "Accept:application/json" > "$COUCH_HOST/open_revs_test/mydoc?open_revs=%5B%222-b1%22%2C%222-b2%22%5D&latest=true" > [{"ok":{"_id":"mydoc","_rev":"3-c2","value":"y-losing"}},{"ok":{"_id":"mydoc","_rev":"4-d1","value":"z-winning"}}] > {code} > Note the reversed order of the results in 2.0 when {{latest=true}} is > specified. -- This message was sent by Atlassian JIRA (v6.3.4#6332)