couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: What would be the best way to exactly duplicate a document, with attachments?
Date Thu, 05 Dec 2013 08:10:39 GMT
this not really possible diectly for now.


maybe copy to a new doc id, replicate this docid  and delete on the source?

(why renaming on the other host?)

On Thursday, December 5, 2013, Daniel Gonzalez wrote:

> Hi all,
>
> Let's say I have host1/db1/doc_id1 which I want to duplicate to
> host2/db2/doc_id2.
>
> The original document has (maybe) attachments. Currently what I am doing
> is:
>
> 1.
> Get doc1. I get an attachment stub.
> 2.
> Put this document to host2/db2/doc_id2
> 3.
> Now I should loop through all attachments, get them, and put them to the
> new document. Probably something will not be guesses right (content_type,
> ...).
>
> Instead, I would like to use a method which:
>
> 1.
> Duplicates the document by using a single GET to obtain the original
> documents + attachments, and creates the new document with a single
> PUT/POST (is this possible, no matter the amount of attachments?)
> 2.
> Does not use the filesystem to save the attachments
> 3.
> Does not use replication
> 4.
> Does not recreate the attachments: specifically, no re-guessing of the
> content type and other attachment properties.
> To make it clear: I want an exact copy of the original document, except
> that:
>
> 1.
> The doc_id is different
> 2.
> It is in a different host/database than the original document
> 3.
> There is no revision
>
> Is there any built-in couchdb support for this?
>
> Thanks,
> Daniel
>
>
> Link to original SO question: http://stackoverflow.com/q/20386913/647991
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message