Adding validate
functions can be a bit odd, because unlike views, there isn't a nice interface in Futon for us to use. The quickest way to add the validate_doc_update
function is to treat it like a normal field in our document and type the code right into the value. It's a bit strange, but it is the quickest way to adjust design documents. At the end of the chapter, I'll give you some resources if you want to get a bit cleaner with how you manage design documents.
1. Open your browser and go to Futon (
http://localhost:5984/_utils/
).2. Make sure that you are logged in to the
admin
account by checking that the bottom right column says Welcome.3. Go to our
verge
database by clicking onverge
.4. Click on our
_design/application
design document.5. Click on Add Field, and call this field
validate_doc_update
.6. In the Value text area, add the following code (formatting and indents don...