[
https://issues.apache.org/jira/browse/COUCHDB-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045624#comment-13045624
]
Nuutti Kotivuori commented on COUCHDB-1184:
-------------------------------------------
If I do a GET to fetch a document, modify it and then do a PUT to insert it
back, leaving "_rev" intact, I should get a conflict if the document has been
modified in any way in the meanwhile. I think this constraint should hold even
if the "modification" is deleting the document.
So, a PUT with a "_rev" on a non-existing document should fail with conflict -
and this behaviour should be consistent with bulk doc inserts as well,
regardless if they contain a design document or not (or if there's a validation
function or not). This way, a PUT without a "_rev" means explicitly "INSERT OR
FAIL" and PUT with a "_rev" means "UPDATE OR FAIL".
This behaviour also means that there is never a need to make the new rev of the
document "one larger" than the "_rev" given in, as there is never a "_rev"
given in on insert - with the possible exception of "all or nothing" bulk
inserts which do not check for conflicts.
> Bulk insert of design documents fails with conflict if the documents contain
> "_rev" when they do not exist in the database
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: COUCHDB-1184
> URL: https://issues.apache.org/jira/browse/COUCHDB-1184
> Project: CouchDB
> Issue Type: Bug
> Affects Versions: 0.11
> Reporter: Nuutti Kotivuori
>
> First a simple example to reproduce:
> $ curl -X PUT http://localhost:5984/repltest
> {"ok":true}
> $ curl -H "Content-type: application/json" -X POST --data
> '{"docs":[{"_id":"_design/a","_rev":"1-2f4a8d26d103e914167052aea70a5031"}]}'
> http://localhost:5984/repltest/_bulk_docs
> [{"id":"_design/a","error":"conflict","reason":"Document update conflict."}]
> So, inserting a previously non-existing design document in to a database via
> bulk docs post fails the inserted design document has a "_rev" member.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira