couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@apache.org>
Subject Re: partial/diff updates?
Date Thu, 27 Nov 2008 07:47:24 GMT
Thanks for bringing this up, Jedediah.



On Wed, Nov 26, 2008 at 10:53 PM, Jedediah Smith
<jedediah@silencegreys.com> wrote:

> GET /db/abc123/foo/bar/2/baz
>
> 3
>
> PUT /db/abc123/foo/durr [4,5,6]

If we require valid _revs for all PUTs (even to subfields) we'll leave
the document semantics only minimally changed. You can use it to cut
down on transfer size. Even enabling it only for top-level attributes
could be a valuable tool.

for array updates:

{
 "_id": "abc123",
 "foo": { "bar": [1,2,{ "baz": 3 }] }
}

PUT /db/absc123/foo/baz/2 {"replace":2}

GET  /db/absc123

{
 "_id": "abc123",
 "foo": { "bar": [1,2,{ "replace": 2 }] }
}

but that's a bit trickier. just allowing top-level field updates (no
deep nesting) keeps us from worrying about arrays.

Changing a field on a remote document becomes just a GET against
_all_docs with key=_id followed by a PUT to the subfield. No diff
format required.



-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message