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.erl#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
<[email protected]> 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 <[email protected]> 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 <[email protected]> wrote:
>>> Christopher Bonhage <[email protected]> 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
>>
>



-- 
Iris Couch

Reply via email to