incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: Moving an attachment from one document to another
Date Sat, 18 Apr 2009 17:52:43 GMT

On 18 Apr 2009, at 12:02, Justin Walgran wrote:

> Does couch provide a way to _atomically_ move an attachment between  
> documents?
> My proposed use case for this feature is for scanning paper documents,
> then splitting them into individual couch documents afterward. Here is
> a rough list of steps:
> - Create a document with the ID 'newscans'
> - Have a desktop application POST image files (acquired from a scanner
> with a sheet feeder) to the 'newscans' document one after another as
> attachments.
> - To process the batch of scanned images, have the user create a new
> couch document, moves a single attachment from 'newscans' to the new
> document ID, then add some metadata. Wash, rinse, repeat.
> So..
> 1) Can this be done with the existing CouchDB trunk?
> 2) If not...
>  2a) Is there a better way?
>  2b) I am an experienced programmer but an erlang noob. At what
> location in the code should I start exploring in order to develop a
> patch.

How about:

Creating new documents with an attribute "new":true, write a view that
filters for "new":true docs and have users take scans from there. or
directly add the meta data to these docs and then remove the new

But even if you keep your method, why does the attachment move need
to be atomic?


View raw message