couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fink Mark <>
Subject question on CouchDB views: how to use a query sting (formula) in the view
Date Mon, 26 Jul 2010 18:23:06 GMT
Hi there,

I am using CouchDB for some time now and now I am stuck with the following

Lets say I store some values from some Physics experiments in couchdb:

ID   x1   x2
1     1     1.1
2     2     1.2
3     3     1.3
4     4     1.4

Now I want to do some calculations within couchdb (NOT on the client side).
Lets say I want to apply some formulas:
y1 = 1*x1 + 0.5*x2*x2
y2 = 1/3*x1 + 0.7*x2*x2*x2

I am thinking about passing the formula as a parameter to the view. Is this
possible without using eval and does the caching still work like if I apply
the same formula again it is faster? Maybe there is a sample available?

For a RDBMS I would probably do something like that:
select (1*x1 + 0.5*x2*x2) as y1 from experiments;

Please do not tell me that I have to use a different view for each formula
because this is not possible besides it is possible to create new views
dynamically when needed.


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