You are viewing a plain text version of this content. The canonical link for it is here.
Posted to erlang@couchdb.apache.org by Stefan Klein <st...@gmail.com> on 2014/01/21 18:45:49 UTC

Access to the ddoc from an validate_doc_update function?

Hi all,

i got a validate_doc_update written in Javascript to validate documents
agains a json-schema.
This function is painful slow, even if i immediately return from the
Javascript and don't actually do work in the function.
I thought to give it a try to implement the vdu in Erlang, got it working
so far with a hard coded schema definition inside the function.

In Javascript I can insert my schema definitions into the design doc and
access it via "this".

Obviously there is no "this" in Erlang and accessing the database is a no
go for consistency reasons (if it's even possible, not sure from googling).

I could use a template to generate the vdu function and include the schemas
into the function or even concat fragments of the function together ... but
i hope there is a more elegant solution.

Any ideas?
Thanks,
Stefan