couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Smith <...@iriscouch.com>
Subject Re: how to delete document with empty _id
Date Fri, 30 Sep 2011 11:02:18 GMT
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 <bwcode4u@gmail.com> wrote:
> Christopher Bonhage <queezey@me.com> writes:
>
>> couchdb -i
>>
>> DbName = <<"database_name_here">>,
>> DocId = <<>>,
>> rr(couchdb),
>> {ok, Db} = couch_db:open(DbName, [{user_ctx, #user_ctx{roles=[<<"_admin">>]}}]),
>> case couch_db:open_doc(Db, DocId) of
>>         {ok, Doc} ->
>>             couch_db:update_doc(Db, Doc#doc{deleted=true}, []);
>>         Error ->
>>             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

Mime
View raw message