Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove a document field before saving in CouchDB?

Tags:

couchdb

I'm POSTing a documents to couchdb and I want to remove doc.phone field if that is null before I save.

Is that possible without using _update handler since I want the request to look like: POST /db

like image 581
ajsie Avatar asked Jul 10 '11 02:07

ajsie


1 Answers

Unfortunately, validation functions do not allow you to mutate the document. (it can only accept or reject a write)

However, if you are concerned with the url, perhaps you could use an update handler in conjunction with URL Rewrites.

like image 170
Dominic Barnes Avatar answered Oct 12 '22 00:10

Dominic Barnes