incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Copenhaver <sean.copenha...@gmail.com>
Subject Re: Allowed contents of validate_doc_update field.
Date Tue, 04 Oct 2011 12:21:49 GMT
Do CommonJS modules work in validate_doc_update?

On Tue, Oct 4, 2011 at 8:04 AM, Jason Smith <jhs@iriscouch.com> wrote:

> I would stick to a pure-function. What if you set `a = /not_bla/` in
> the function? But CouchDB might start many simultaneous Javascript
> processes, so you will not know the value of `a` later.
>
> I admit that sometimes I wish I could put constants and other things
> outside the function, for readability.
>
> P.S. /regex/.test(str) does not work on some builds of CouchDB (or
> rather, some builds of Spidermonkey) which are still in use. It is
> safer to use str.match(/regex) which I also find less readable :)
>
> On Tue, Oct 4, 2011 at 3:35 PM, Marcello Nuccio
> <marcello.nuccio@gmail.com> wrote:
> > Is it supported to put anything other than an anonymous function in
> > the validate_doc_update field of a design document?
> >
> > For example:
> >
> >    var a = /bla/;
> >    function (doc, oldDoc, userCtx, secObj) {
> >        if (!a.test(doc._id)) ...
> >    }
> >
> > is it supported or it can work only by coincidence.
> >
> > Thanks,
> >  Marcello
> >
>
>
>
> --
> Iris Couch
>



-- 
“The limits of language are the limits of one's world. “ - Ludwig von
Wittgenstein

"Water is fluid, soft and yielding. But water will wear away rock, which is
rigid and cannot yield. As a rule, whatever is fluid, soft and yielding will
overcome whatever is rigid and hard. This is another paradox: what is soft
is strong." - Lao-Tzu

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message