incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils Breunese <N.Breun...@vpro.nl>
Subject Re: couchdb: function eval on insert, update...
Date Thu, 03 Nov 2011 13:59:26 GMT
N/A N/A wrote:

> Any plans to implement doc features, like expression evaluation on insert or update in
CouchDB? For example:
> POST:
> {
> "test1": "1",
> "test2": "2",
> "test3": function(doc) {
> var res = doc.test1 + doc.test2
> return res;
> /* or maybe even                if (doc["test2"]) {
> doc["test4"]();
> } else {
> ... more stuff...
> }
> */
>     }
> "test4": function(doc_or_maybe_something_else) { ... }
> }
>
> result in couchdb:
> {
> "test1": "1",
> "test2": "2",
> "test3": "3"
> // ..etc.
> }

Document update handlers [0] can be used to invoke server-side logic to create or update a
document. Maybe you can use this to solve your use case?

Nils

[0] http://wiki.apache.org/couchdb/Document_Update_Handlers
------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------

Mime
View raw message