You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Alux <al...@googlemail.com> on 2010/07/28 09:47:52 UTC

how to delete if _id="" ?

Hello,

today I got a slightly funny problem. Creating a document using an update
handler, I had the hope an _id would be crated if I dont provide one
(similar to POST do the DB). This hope was in vain, so now I have one
document with _id: "". (I did only once, because the second try gave an
update conflict of course :) Futon doesn't give the possibility to open it
(because a link text of length 0 doesnt make a link in the browsers I
tested: Firefox, Opera, Crome), and I just can't imagine to curl it (curl -X
DELETE http://locahost/sofa/ should rather delete the DB, right??).

Any ideas?

Thank you a lot & kind regards

alux

Re: how to delete if _id="" ?

Posted by afters <af...@gmail.com>.
On 28 July 2010 10:47, Alux <al...@googlemail.com> wrote:

> Hello,
>
> today I got a slightly funny problem. Creating a document using an update
> handler, I had the hope an _id would be crated if I dont provide one
> (similar to POST do the DB). This hope was in vain, so now I have one
> document with _id: "". (I did only once, because the second try gave an
> update conflict of course :) Futon doesn't give the possibility to open it
> (because a link text of length 0 doesnt make a link in the browsers I
> tested: Firefox, Opera, Crome), and I just can't imagine to curl it (curl
> -X
> DELETE http://locahost/sofa/ should rather delete the DB, right??).
>
> Any ideas?
>
>
I had the same issue a few days ago. I did ask about it in the irc channel,
but no one came up with a way to remove it, except for deleting the entire
DB (which worked for me). Apparently, an empty string is considered to be a
legal value for a doc's '_id', even though you can't really do much with
such a document.

I think this edge case is confusing, and maybe should not be exposed to
users at all.

 a.


> Thank you a lot & kind regards
>
> alux
>

Re: how to delete if _id="" ?

Posted by Alux <al...@googlemail.com>.
Sounded good.

$ curl -X POST -H "content-type: application/json" http://localhost/sopha -d
@no_id.json

returned
{"ok":true,"id":"9894038c9531e364efee7644dd000c8d","rev":"1-de715bf126efc93d225d9e3f8e8eb81a"}

So it happily created a new document, with a shiny new id. (And then it took
me a while, to understand why I cannot see it in futon. (Futon doesnt show
deleted docs.))

Hm.

Thanks nevertheless. I hadnt tried that.

regards, alux



On 30 July 2010 15:54, Simon Metson <si...@googlemail.com> wrote:

> Hi,
>        Could you post {"_id": "", "_deleted": true} to the database?
> Cheers
> Simon
>
>
> On 28 Jul 2010, at 09:47, Sebastian Cohnen wrote:
>
>  I have no idea how you can remove this document, but maybe you could open
>> a JIRA ticket on this (since an empty document ID should not happen).
>>
>> On 28.07.2010, at 09:47, Alux wrote:
>>
>>  Hello,
>>>
>>> today I got a slightly funny problem. Creating a document using an update
>>> handler, I had the hope an _id would be crated if I dont provide one
>>> (similar to POST do the DB). This hope was in vain, so now I have one
>>> document with _id: "". (I did only once, because the second try gave an
>>> update conflict of course :) Futon doesn't give the possibility to open
>>> it
>>> (because a link text of length 0 doesnt make a link in the browsers I
>>> tested: Firefox, Opera, Crome), and I just can't imagine to curl it (curl
>>> -X
>>> DELETE http://locahost/sofa/ should rather delete the DB, right??).
>>>
>>> Any ideas?
>>>
>>> Thank you a lot & kind regards
>>>
>>> alux
>>>
>>
>>
>

Re: how to delete if _id="" ?

Posted by Simon Metson <si...@googlemail.com>.
Hi,
	Could you post {"_id": "", "_deleted": true} to the database?
Cheers
Simon

On 28 Jul 2010, at 09:47, Sebastian Cohnen wrote:

> I have no idea how you can remove this document, but maybe you could  
> open a JIRA ticket on this (since an empty document ID should not  
> happen).
>
> On 28.07.2010, at 09:47, Alux wrote:
>
>> Hello,
>>
>> today I got a slightly funny problem. Creating a document using an  
>> update
>> handler, I had the hope an _id would be crated if I dont provide one
>> (similar to POST do the DB). This hope was in vain, so now I have one
>> document with _id: "". (I did only once, because the second try  
>> gave an
>> update conflict of course :) Futon doesn't give the possibility to  
>> open it
>> (because a link text of length 0 doesnt make a link in the browsers I
>> tested: Firefox, Opera, Crome), and I just can't imagine to curl it  
>> (curl -X
>> DELETE http://locahost/sofa/ should rather delete the DB, right??).
>>
>> Any ideas?
>>
>> Thank you a lot & kind regards
>>
>> alux
>


Re: how to delete if _id="" ?

Posted by Sebastian Cohnen <se...@googlemail.com>.
I have no idea how you can remove this document, but maybe you could open a JIRA ticket on this (since an empty document ID should not happen).

On 28.07.2010, at 09:47, Alux wrote:

> Hello,
> 
> today I got a slightly funny problem. Creating a document using an update
> handler, I had the hope an _id would be crated if I dont provide one
> (similar to POST do the DB). This hope was in vain, so now I have one
> document with _id: "". (I did only once, because the second try gave an
> update conflict of course :) Futon doesn't give the possibility to open it
> (because a link text of length 0 doesnt make a link in the browsers I
> tested: Firefox, Opera, Crome), and I just can't imagine to curl it (curl -X
> DELETE http://locahost/sofa/ should rather delete the DB, right??).
> 
> Any ideas?
> 
> Thank you a lot & kind regards
> 
> alux