[ 
https://issues.apache.org/jira/browse/COUCHDB-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15038580#comment-15038580
 ] 

Alexander Shorin commented on COUCHDB-2910:
-------------------------------------------

bulk_docs are not intended to use transaction semantic. Basically, there are no 
any transaction things in CouchDB that covers multiple documents. CouchDB 
cannot guarantee consistency as it AP database.

What you can do is enforce conflicts creation using "all_or_nothing": true 
field in the request payload. Then, if there are indeed conflicts happened, you 
need to resolve them. And in case of all_or_nothing, if any document will fail 
validation checks, you'll get HTTP 412 response as signal that something went 
wrong. But again, that's not intended to be used for transactions as it happens 
in other C* databases.

> Wrong HTTP Status Code on Error
> -------------------------------
>
>                 Key: COUCHDB-2910
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2910
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Kerem Güneş
>
> Hi,
> If I send  a _rev that will cos conflict, server is sending 201 code.
> POST /foo/_bulk_docs? HTTP/1.0
> Host: localhost:5984
> Connection: close
> Accept: application/json
> Content-Type: application/json
> User-Agent: Couch/v1.0.0 (+http://github.com/qeremy/couch-go)
> Content-Length: 126
> {"docs":[{"_id":"7ee9cdd673b109e030cec8c6f10020f7","_rev":"1-WRONG-REV","name":"kerem
>  3","type":"tmp"}]}
> HTTP/1.0 201 Created
> Server: CouchDB/1.5.0 (Erlang OTP/R16B03)
> Date: Thu, 03 Dec 2015 20:11:02 GMT
> Content-Type: application/json
> Content-Length: 100
> Cache-Control: must-revalidate
> [{"id":"7ee9cdd673b109e030cec8c6f10020f7","error":"conflict","reason":"Document
>  update conflict."}]
> Thank you!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to