Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0CF11698C for ; Thu, 9 Jun 2011 20:33:37 +0000 (UTC) Received: (qmail 31933 invoked by uid 500); 9 Jun 2011 20:33:35 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 31889 invoked by uid 500); 9 Jun 2011 20:33:35 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 31881 invoked by uid 99); 9 Jun 2011 20:33:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 20:33:35 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of binary42@gmail.com designates 209.85.216.52 as permitted sender) Received: from [209.85.216.52] (HELO mail-qw0-f52.google.com) (209.85.216.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 20:33:27 +0000 Received: by qwb8 with SMTP id 8so1248008qwb.11 for ; Thu, 09 Jun 2011 13:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to :x-mailer; bh=BP8EiFJj7MIdU1Y0xGwDRtNJXVtx2p33arfeu77a7LE=; b=DR2wCO+xRfzO9gLrjEHC4iDzDlC95heROpI5LhH+dydIHfbEb+ypHR+2RHceD3ZDV/ rarFdOChircxc4icquRSBQZBL1mDCwo75Jl43HkdLl6YcOzwb4mw0bbWOXGuKAzJxQjQ ym0ZXbpeEdVkDp22qyr76TsBGxlhIyDkciXkI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=it027YeYst2z4uCQgVT6rrWjxIGU0uiKwIxD+Go86/NQfKcxJ/am27pl9xvXbWXhuv Tf/aJgieUfUxTpozzSWD1nbwN3GtCIfjhZLqRnWkqQN78M8xEEOXpqQBcNqXLgLPJI1P KoawDJWFEhx++E3WEnCf53yUx235Ec6CpizEs= Received: by 10.224.126.202 with SMTP id d10mr944645qas.253.1307651586557; Thu, 09 Jun 2011 13:33:06 -0700 (PDT) Received: from [10.0.1.45] (cpe-74-68-154-176.nyc.res.rr.com [74.68.154.176]) by mx.google.com with ESMTPS id e28sm1557706qck.6.2011.06.09.13.33.04 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Jun 2011 13:33:05 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1237.1) Subject: Re: JSON Patch Internet Draft 01 From: Brian Mitchell In-Reply-To: Date: Thu, 9 Jun 2011 16:33:02 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <80FD8EDC-6283-4883-901A-9ED52705BACE@gmail.com> References: <1307642964.1706.84.camel@dynamo> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1237.1) On 2011-06-09, at 15:47 , Daniel Itabora=ED wrote: > This is great stuff! >=20 > It would be nice to have some more operations like "increment", = "decrement", > "push", "pop", "compare-and-swap", etc. I think error handling should = be > better addressed, possibly returning an array of "result" objects (or > something similar). >=20 > Also, I don=B4t think one should mention idempotency of patches, since = they > seem to me inherently state dependent. >=20 > regards, > Daniel This sort of update seems to be better implemented with update handlers. = Even simple cases like decrement can create lots of cases. What to do at = 0? Do we support decrement other than one? Do we support decrement of = non-integral values? How about the case where the value isn't a number = or doesn't exist? All of these cases are easily taken care of by update = handlers. We can even write an update handler that calls other update = handlers thanks to code-sharing via common-js modules. Now there is = debate as to how easy it is to write some of those and if CouchDB should = make some of it easier but it's a start on the single document level. = (Also, bulk update calls would be interesting but that's another = thread.) Now what I see PATCH being useful for is efficiency. It not only allows = you to avoid large repetition in payload but could also have slightly = better concurrency since one could check the current revision against = the request's revision for just the given patches. One could approximate = this with an update handler though this might have elegance since it = could work out of the box if the specification of JSON PATCH is = carefully crafted and implemented. For now it's just interesting though = since I think we'll get more milage from update handler improvements. = Maybe the future will include PATCH support, maybe not. Brian.=