debasishg / scouchdb

CouchDB Driver and View Server in Scala
http://debasishg.blogspot.com
73 stars 14 forks source link

Add CouchDB validation functions #1

Closed debasishg closed 15 years ago

debasishg commented 15 years ago

The DesignDocument needs to take optional validation functions to be fired during all subsequent document updates.

debasishg commented 15 years ago

Check out View Server protocol for details. Paul Davis suggests the following :--

  1. In the test subdirectory there is a Ruby spec file that tests view server implementations for protocol compatibility. Its a JSON-over-stdio protocol, so for all CouchDB cares, you could write a view server in Bash.
  2. It all goes to the view server. I'd suggest checking out that rspec test suite as well as ./share/server/validate.js and ./share/server/loop.js to see how calls get passed. The protocol is something like:

Input: ["validate", functionSrc, newDoc, oldDoc, request]\n Ouput: 1\n or 0\n

Or something similar to that.