couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: different results for same group levels
Date Thu, 08 Oct 2009 05:46:09 GMT
On Thu, Oct 8, 2009 at 5:15 AM, Francisco Viramontes <paco@freshout.us> wrote:
> I have a views problem that I dunno if can be solved by couch
>
> here is my map function:
>
> function(doc) {
>        if ((doc['couchrest-type'] == 'DataValue') &&
> doc['device_variable_id']) {
>          date =  new Date(doc.date_time);
>          emit([doc.device_variable_id, date.getFullYear(),
> date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(),
> parseInt(date.getUTCMinutes() / 20) ], doc.value);
>        }
>      }
>
> Please just min the last key portion emited -> parseInt(date.getUTCMinutes()
> / 20)
>
> I use this to sum in groups of values of data for every 20 minutes
>
> I DONT want to make another view if say for example I want to emit for 5
> minutes
>
> Views already take too much space!!!
>
> Is there a view I can make that handle conditional key emiting or something
> that I can pass a parameter to?
>
> PAco
>

you can't use date in your views. emit the key you need and try to
play with startkey/endkey to find it.

- benoît

Mime
View raw message