From user-return-18139-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Sep 30 16:30:16 2011 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 C522670E1 for ; Fri, 30 Sep 2011 16:30:16 +0000 (UTC) Received: (qmail 84455 invoked by uid 500); 30 Sep 2011 16:30:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 84413 invoked by uid 500); 30 Sep 2011 16:30:15 -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 84405 invoked by uid 99); 30 Sep 2011 16:30:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Sep 2011 16:30:15 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of zachary.zolton@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Sep 2011 16:30:11 +0000 Received: by vws10 with SMTP id 10so2237016vws.11 for ; Fri, 30 Sep 2011 09:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=JM1Xvks6dfwQ2xHuWI8x9E2mthZKwRl7EHFR5i+OOhU=; b=P86R/3EYTPfGJp9+3h9ltfKxW+gmQIee5CS0qYKhNL4bqflC1PLxTENWzBLth5wWoy lKr0jGvsXi4YxP13aYadrw3nFC8KinJ+FF+O1O/W6oHqbRPWxQjVEFeV1GjpW/XxOilY qhJ6zG0pjc2G/Mvz3Irh2We2XxKF2zWkLNdWA= Received: by 10.68.15.71 with SMTP id v7mr59159202pbc.111.1317400190093; Fri, 30 Sep 2011 09:29:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.69.17 with HTTP; Fri, 30 Sep 2011 09:29:30 -0700 (PDT) In-Reply-To: References: <86k48vt8mt.fsf@gmail.com> <540B5FB6-9DE8-4913-9ABB-D67C49643893@4things.co.za> <4E816609.7030204@gmail.com> <4E8173B8.3060900@gmail.com> <4E8185D9.1070900@gmail.com> <86y5x8blow.fsf@gmail.com> From: Zachary Zolton Date: Fri, 30 Sep 2011 11:29:30 -0500 Message-ID: Subject: Re: how to delete document with empty _id To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you Jason, good to know. On Fri, Sep 30, 2011 at 11:16 AM, Jason Smith wrote: > I do not think Damien's suggestion works. During bulk updates, CouchDB > will replace both a missing ID and also an empty string ID with a > UUID. > > https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_httpd_db.e= rl#L296-299 > > and > > https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_db.hrl#L99= -101 > > On Fri, Sep 30, 2011 at 10:15 PM, Zachary Zolton > wrote: >> Does the _update function do the same thing as Damien's suggestion to >> POST to _bulk_docs? (Just curious) >> >> On Fri, Sep 30, 2011 at 6:02 AM, Jason Smith wrote: >>> You can delete the problematic document with an empty ID using a >>> Javascript _update function. >>> >>> I wrote about it at >>> http://stackoverflow.com/questions/7604557/how-do-you-delete-a-couchdb-= document-with-an-empty-document-id/7605456#7605456 >>> >>> Basically just make an _update function which returns [{_id:"", >>> _rev:$your_rev, _deleted:true}, "Hasta lasagna, baby"]; >>> >>> On Thu, Sep 29, 2011 at 12:50 AM, bsquared wrote: >>>> Christopher Bonhage writes: >>>> >>>>> couchdb -i >>>>> >>>>> DbName =3D <<"database_name_here">>, >>>>> DocId =3D <<>>, >>>>> rr(couchdb), >>>>> {ok, Db} =3D couch_db:open(DbName, [{user_ctx, #user_ctx{roles=3D[<<"= _admin">>]}}]), >>>>> case couch_db:open_doc(Db, DocId) of >>>>> =A0 =A0 =A0 =A0 {ok, Doc} -> >>>>> =A0 =A0 =A0 =A0 =A0 =A0 couch_db:update_doc(Db, Doc#doc{deleted=3Dtru= e}, []); >>>>> =A0 =A0 =A0 =A0 Error -> >>>>> =A0 =A0 =A0 =A0 =A0 =A0 Error >>>>> end. >>>>> >>>>> >>>> >>>> It appears that I need to include a user_ctx record the response from >>>> this code was: >>>> * 5: record user_ctx undefined >>>> >>>> -- >>>> Regards, >>>> Brian Winfrey >>>> >>>> >>> >>> >>> >>> -- >>> Iris Couch >>> >> > > > > -- > Iris Couch >