couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heike Bernhard <>
Subject Validate_doc_update required fields - can't delete documents
Date Fri, 08 Jan 2010 23:11:31 GMT

I'm new to CouchDB and I've just wrote my first validate function
(thanks to the book "CouchDB: The definitive guide"). But now I have a
problem, when I want to delete documents.

For each document there are two fields required (firstName and lastName)
and my function looks like this:

"validate_doc_update": "function(newDoc, oldDoc, userCtx)
  function require(field, message)
    message = message || \"Document requires the field \" + field;
    if (!newDoc[field]) throw({forbidden : message});
  if (newDoc)

So if I want to delete a document, I get an error, because of the
required fields:

user@computer:~$ curl -X DELETE
{"error":"forbidden","reason":"Document requires the field lastName"}

What am I missing?
Thanks for any hints.


View raw message