There is a bug in CouchDB that allows this to happen. I believe that it was introduced in v1.1.0 and will be fixed in versions v1.1.1 and v1.2.0.
The error is that _update functions can create documents with identifiers with an empty string. To delete a document, use the same update function and use the same error.
For instance:
{ "_id": "_design/example", "updates": { "del_blank": "function(doc, req) { var doc = {_id:'', _rev:req.query.rev, _deleted:true}; return [doc, 'Trying to delete nastydoc@ '+doc._rev]; }" } }
Just indicate the version that gives you the problem and it marks it deleted.
$ rev="1-2f11e026763c10730d8b19ba5dce7565" $ curl -XPOST localhost:5984/db/_design/example/_update/del_blank?rev=$rev Trying to delete nastydoc@1-2f11e026763c10730d8b19ba5dce7565 $ curl localhost:5984/db/_all_docs {"total_rows":1,"offset":0,"rows":[ {"id":"_design/example","key":"_design/test","value":{"rev":"2-b9bfbedff0c09fab88ff36d06cec0d34"}}, ]}
source share