couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: Using _rev in application logic
Date Thu, 01 Apr 2010 16:25:26 GMT

On Apr 1, 2010, at 9:17 AM, Moritz Post wrote:

> Hi Guys
> 
> Thanks for clarifying the situation with the _rev field and pointing out
> alternative solutions. Your mentioned issues sound valid to me.
> 

It can also make sense to take the loaded version of the document and attach it as a binary
attachment with the next edit

that keeps the JSON doc from growing without bound (and keeps old versions out of views, but
replicating with the current version)

Chris

> Until the next questions...  :)
> 
> Regards
> Moritz
> 
> On Thu, Apr 1, 2010 at 3:59 PM, Alan Boyce <alan@alanboyce.com> wrote:
> 
>> Hi Moritz
>> 
>> I wouldn't use _rev, see Jan's response. I would use update handlers.
>> See here:
>> 
>> 
>> http://wiki.apache.org/couchdb/How_to_intercept_document_updates_and_perform_additional_server-side_processing
>> 
>> So you could create a revision in the document on update.
>> 
>> {
>> title: "I'm a document",
>> body: "This couchdb stuff is cool."
>> revisions: [{title: "I'm a document", body:"this couchdb stuff is
>> cool."}],
>> update_note: "fixed capitalization of 'this' in body"
>> }
>> 
>> best,
>> alan
>> 
>> 
>> On Thu, 2010-04-01 at 14:32 +0200, Moritz Post wrote:
>>> Hi CouchDB people
>>> 
>>> I am currently playing with the couchdb and pretty impressed by several
>> of
>>> the feature on offer. Great job so far. While reading up on various web
>>> resources i have come to conclude that it is discouraged to use the _rev
>>> field for application related logic since the revisions are removed when
>>> compacting and they are not replicated when using replication.
>>> 
>>> Looking at my possible usecase however, i would very much like to use the
>>> _rev key to track changes in my document. So here are several questions
>>> regarding that topic:
>>> 
>>> 1. Is it generally discouraged to use the _rev in application logic?
>>> 2. Is compacting something i would like to do for other reasons than to
>>> remove older revisions (so i could basically not do it)
>>> 2. Is it possible to somehow also replicate the revision while
>> replicating?
>>> 3. Is it good practice to use the _rev field in views?
>>> 
>>> Any other clarifications in regards to _rev are also welcome.
>>> 
>>> Thanks in advance and keep up the good work
>>> 
>>> Greets
>>> Moritz
>> 
>> 
>> 


Mime
View raw message