On 14/11/2008, at 11:01 AM, Antony Blakey wrote:
On 14/11/2008, at 10:39 AM, Chris Anderson wrote:
On Thu, Nov 13, 2008 at 3:37 PM, Noah Slater <[EMAIL PROTECTED]>
wrote:
I did some digging to see what else is out there:
* http://intertwingly.net/blog/2008/02/21/APP-Level-Patch
* http://blog.mozilla.com/rob-sayre/2008/02/15/restful-partial-updates/
* http://www.snellspace.com/wp/?p=895
* http://lists.w3.org/Archives/Public/ietf-http-wg/2008JanMar/0316.html
* http://www.snellspace.com/wp/?p=902
Forgive me for throwing out a loose-cannon idea, but would it be
easiest to provide an API where the user sends a Javascript function
to CouchDB via the PATCH method? The function could look something
like:
function(doc) {
doc.my_field = "new value";
doc.existing_array[3] = "another new value";
doc.new_array = ["a", "b", 3];
return doc;
}
I thought that javascript wasn't part of the Couch core? JSON isn't
javascript, and all uses of javascript *could* be replaced with e.g.
Ruby (or my interest, Smalltalk), which is why there is a "language"
attribute on the views.
Your proposal would change that.
You could use the view mechanism, and attach a "language" attribute,
and have this be a general transformation interface, which would
indeed be very nice. For efficiency you would want to apply this over
sets of documents, and probably in a transactional context like bulk
update does now.
However... Damien wants something to use in replication, which would
mean that javascript would then become a required, rather than an
optional part of Couch, because replication would require it (unless
you made the replication diff generator pluggable ... but why go
there?). The benefit of the declarative diff format is that applying a
diff can be done within Couch.
Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787
It's amazing that the one side of the conversation that survived is "I
don't know art, but I know what I like". The reply from the artist was
"Madam, so does a cow".
-- Carl Kirkendall