incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: DELETE doc without rev
Date Tue, 19 Oct 2010 15:12:17 GMT
it's _deleted not _delete

B.

On Tue, Oct 19, 2010 at 10:43 AM, Alex Ivasyuv <industral@gmail.com> wrote:
> On 10/19/2010 04:54 PM, Johannes Jörg Schmidt wrote:
>>
>> You could write an update function which sets doc._delete to true. This
>> way
>> you can delete a document sending only one request.
>>
>
> That's exactly that I looked for, but unfortunately it doesn't work for me:
>
> {"error":"doc_validation","reason":"Bad special document member: _delete"}
>
> CouchDB 1.0.1
>
> Code:
>
> function(doc, request) {
>
>  // if no record found, we create it manually
>  if (!doc) {
>    doc = {
>      _id: request.id
>    };
>  }
>
>  if (request.query.action === "delete") {
>    doc._delete = true;
>  } else {
>
>    // set all passed params to object
>    for (i in request.query) {
>      doc[i] = request.query[i];
>    }
>  }
>
>  // save doc
>  return [
>    doc,
>    JSON.stringify({
>      result: "success"
>    })];
> }
>
>> Greetings Johannes
>> Am 19.10.2010 15:30 schrieb "Matt Goodall"<matt.goodall@gmail.com>:
>>
>>
>>>
>>> On 19 October 2010 12:35, Alex Ivasyuv<industral@gmail.com>  wrote:
>>>
>>>>
>>>> Thanks Matt for reply, but question still exist, is there some way to
>>>>
>>>
>>> delete
>>>
>>>>
>>>> doc in ONE request without mentioned revision. In your example I need to
>>>> make a GET request first.
>>>>
>>>
>>> It's not possible in 1 request. As I said, you must provide the current
>>> _rev.
>>>
>>> - Matt
>>>
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Sent from my HTC
>>>>
>>>> ----- Reply message -----
>>>> From: "Matt Goodall"<matt.goodall@gmail.com>
>>>> Date: Tue, Oct 19, 2010 2:04 pm
>>>> Subject: DELETE doc without rev
>>>> To:<user@couchdb.apache.org>
>>>>
>>>
>>>
>>>>
>>>> On 19 October 2010 11:39, Alex Ivasyuv<industral@gmail.com>  wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I would like to...
>>>>>
>>>
>>>
>>
>>
>
>
> --
> Best regards,
> Alex Ivasyuv
> Senior WebUI Software Engineer
> ReelRoles, Inc.
>
>
>

Mime
View raw message