couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giovanni Lenzi <>
Subject Re: [PROPOSAL] Allow rewrites to be JS function
Date Mon, 28 Sep 2015 14:54:21 GMT
Having the userCtx at rewrite level enables a new whole world of
possibilities for app developers and mantainers:
* high level of flexibility and customization
* acl with view performance
* and, above all, extreme ease of control and maintenance over their data.

All they need to do is to write a view returning user/role filtered set of
docs. Something like:

["john","org.couchdb.user:john"] => org.couchdb.user:john
["john","docA"] => "docA"
["john","docB"] => "docB"
["marc","org.couchdb.user:marc"] => "docB"
["marc","docB"] => "docB"

which is then called with the first key (username/role), set server-side by
this custom JS function, so preventing any client-side manipulation.

JS rewriting functions can ease supporting activities too, allowing
mantainers to check which documents are visible to each users, by just
checking if they are returned by this view.

In the end, but maybe most importantly, this could represent a real
game-changing enhancement for pouch-apps developers too, letting them to
finally manage a fixed number of databases, as opposed to the current
uncontrollable and hard-to-mantain database-per-user approach. This could
be great for pouch-apps mantainers too, allowing them to retrieve system
overall statistics with the ease of just writing a simple couchdb view.

>> regular expression rewrites
>It gives not much more, then current implementation. I‘d say, it gives even

Agree! Current implementation is limited by the lack of concepts like
userCtx,request object and time, rather than its expressive power. As app
developer, I'm afraid regexps could complicate things instead, thus missing
the chance to give them what they really need.

One week for such incredible enhancement which doesn't even affect the
actual "way to couchapp" or current performances??? WOW, simply Great Job
ermouth and robin!!! Your contribution has no price for this community. I
hope this dream can really become true on next couchdb releases!

Giovanni Lenzi
Smileupps Cloud App Store

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