Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-3264

POST to _all_docs does not respect conflicts=true

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.0
    • Component/s: Database Core
    • Labels:
      None

      Description

      In CouchDB 2.0, POST to _all_docs with ids specified in the keys field does not respect the conflicts=true parameter.

      In CouchDB 1.6.1:

      $ curl -X PUT http://127.0.0.1:5984/test
      {"ok":true}
      
      $ curl -X POST http://127.0.0.1:5984/test/_bulk_docs -H 'Content-type:application/json' -d '{ "docs":[{"_id":"foo","_rev": "1-a1"},{"_id":"foo","_rev": "1-a2"}], "new_edits":false}'
      []
      
      $ curl -X GET 'http://127.0.0.1:5984/test/_all_docs?include_docs=true&conflicts=true'
      {"total_rows":1,"offset":0,"rows":[
      {"id":"foo","key":"foo","value":{"rev":"1-a2"},"doc":{"_id":"foo","_rev":"1-a2","_conflicts":["1-a1"]}}
      ]}
      
      $ curl -X POST 'http://127.0.0.1:5984/test/_all_docs?include_docs=true&conflicts=true' -H 'Content-type:application/json' -d '{"keys":["foo"]}'
      {"total_rows":1,"offset":0,"rows":[
      {"id":"foo","key":"foo","value":{"rev":"1-a2"},"doc":{"_id":"foo","_rev":"1-a2","_conflicts":["1-a1"]}}
      ]}
      

      In CouchDB 2.0:

      $ curl -X PUT http://127.0.0.1:15984/test
      {"ok":true}
      
      $ curl -X POST http://127.0.0.1:15984/test/_bulk_docs -H 'Content-type:application/json' -d '{ "docs":[{"_id":"foo","_rev": "1-a1"},{"_id":"foo","_rev": "1-a2"}], "new_edits":false}'
      []
      
      $ curl -X GET 'http://127.0.0.1:15984/test/_all_docs?include_docs=true&conflicts=true'
      {"total_rows":1,"offset":0,"rows":[
      {"id":"foo","key":"foo","value":{"rev":"1-a2"},"doc":{"_id":"foo","_rev":"1-a2","_conflicts":["1-a1"]}}
      ]}
      
      $ curl -X POST 'http://127.0.0.1:15984/test/_all_docs?include_docs=true&conflicts=true' -H 'Content-type:application/json' -d '{"keys":["foo"]}'
      {"total_rows":1,"rows":[
      {"id":"foo","key":"foo","value":{"rev":"1-a2"},"doc":{"_id":"foo","_rev":"1-a2"}}
      ]}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wilhol Will Holley
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: