Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B2D6C887B for ; Sat, 20 Aug 2011 20:22:53 +0000 (UTC) Received: (qmail 11513 invoked by uid 500); 20 Aug 2011 20:22:52 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 11253 invoked by uid 500); 20 Aug 2011 20:22:51 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 11231 invoked by uid 99); 20 Aug 2011 20:22:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Aug 2011 20:22:51 +0000 X-ASF-Spam-Status: No, hits=-2001.1 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Aug 2011 20:22:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 453DDC64B9 for ; Sat, 20 Aug 2011 20:22:27 +0000 (UTC) Date: Sat, 20 Aug 2011 20:22:27 +0000 (UTC) From: "Benjamin Young (JIRA)" To: dev@couchdb.apache.org Message-ID: <1873566588.56023.1313871747280.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-605) _update handler doesn't conflict for existing document MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088260#comment-13088260 ] Benjamin Young commented on COUCHDB-605: ---------------------------------------- I see this as part of the benefit/usefulness of _update--that you can, as needed, ignore the MVCC pattern and update a doc regardless of matching _rev's. However, it should be possible to implement this by comparing a "rev" query param to the doc._rev if an existing ID is used. Sadly, (due to issue COUCHDB-648) it's not possible to send 409 Conflict error "by hand" (or any other developer chosen status code). Basically, _update handlers seem to need a bit more love before they'll be completely useful for stand-along apps or APIs built on top of CouchDB. > _update handler doesn't conflict for existing document > ------------------------------------------------------ > > Key: COUCHDB-605 > URL: https://issues.apache.org/jira/browse/COUCHDB-605 > Project: CouchDB > Issue Type: Bug > Affects Versions: 0.10 > Environment: Ubuntu Karmic, in particular it's CouchDB version 0.10.0-0ubuntu3 > Reporter: Sergey Shepelev > Assignee: Chris Anderson > > design doc: > "updates": { > "hello": "function(doc, req) { doc.value = 100500; return [doc, 'foo bar']; }" > } > $ curl -X PUT --data-binary @- http://localhost:5984/shkaf/client:foo << EOF > > {"_id":"client:foo"} > > EOF > {"ok":true,"id":"client:foo","rev":"1-967a00dff5e02add41819138abb3284d"} > $ curl -X PUT --data-binary @- http://localhost:5984/shkaf/_design/client/_update/hello/client:foo?A=B << EOF > > {"_id": "client:foo"} > > EOF > foo bar > And it really updated the document. > What i expected here is error: conflict because document with such _id already existed and i didn't provide _rev to _update handler. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira