On Thu, Oct 8, 2009 at 5:15 AM, Francisco Viramontes <[email protected]> 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
