Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E443310896 for ; Thu, 5 Dec 2013 08:11:44 +0000 (UTC) Received: (qmail 79071 invoked by uid 500); 5 Dec 2013 08:11:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 78776 invoked by uid 500); 5 Dec 2013 08:11:10 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 78565 invoked by uid 99); 5 Dec 2013 08:11:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 08:11:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bchesneau@gmail.com designates 209.85.192.179 as permitted sender) Received: from [209.85.192.179] (HELO mail-pd0-f179.google.com) (209.85.192.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 08:11:00 +0000 Received: by mail-pd0-f179.google.com with SMTP id r10so24349474pdi.10 for ; Thu, 05 Dec 2013 00:10:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=TgT0nRL51I46M4TiiGZMZQjMTvMTCFhfpSnPqjKsmjc=; b=GaRYbb9XvT8umdUGZuKvfhVLngaCKNyNUm4HlWMeW/EMGVVt+gYbsT2YZm/OUM1/HX I96U/vizSz4uVciButtEwVOxbpefz1gwWl+lvGie4eNhG/oiOqpnEvq+SV5+XFYrKpu0 N1ZnDWXBXy5nBIICasxmLbwnWZ2qn4+CIxUz8lQl2qSJvdNwE736LVF/Of1tzsXsWSvO qIExs6P25FqraoEX+/NbTY7WPWIO28Il/0eVbB1F6Ot9Jt3TzFhFqBvOtkrH0fqaZyhS 2l0eL/kGPXogDSTKyEAIfAnQ0qJe+AthUQEcWtmkdmWU2Ph9t3O3BP+M9lulxmQMoU8p SLpw== MIME-Version: 1.0 X-Received: by 10.66.144.40 with SMTP id sj8mr86643673pab.4.1386231039965; Thu, 05 Dec 2013 00:10:39 -0800 (PST) Received: by 10.70.59.7 with HTTP; Thu, 5 Dec 2013 00:10:39 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Dec 2013 09:10:39 +0100 Message-ID: Subject: Re: What would be the best way to exactly duplicate a document, with attachments? From: Benoit Chesneau To: "user@couchdb.apache.org" Content-Type: multipart/alternative; boundary=047d7b6dc008b6c01204ecc510a9 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b6dc008b6c01204ecc510a9 Content-Type: text/plain; charset=ISO-8859-1 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 > --047d7b6dc008b6c01204ecc510a9--