incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian Westreicher Bakk.techn." <st...@meredrica.org>
Subject Re: couchdb teporaly average view
Date Sat, 30 Nov 2013 08:25:30 GMT
I think Roberts' approach is better, especially for disk usage. 

Simon Metson <simon@cloudant.com> wrote:
>If you split your data out into a list like [year, month, day, hour,
>minute] and used that as the key for the map you’d be able to query
>with different group levels to get averages at different granularities.
> 
>
>
>On Friday, 29 November 2013 at 10:58, Robert Newson wrote:
>
>> map:
>>  
>> emit(doc.created, doc.value);
>>  
>> reduce:
>>  
>> _stats
>>  
>> then query with startkey and endkey appropriately. This will give you
>> the sum of all values between the two keys and the number of rows.
>> Divide one by the other to derive mean average. This will work for
>> startkey/endkey's that span hours, days or weeks.
>>  
>> B.
>>  
>>  
>> On 28 November 2013 20:22, Gerardo Di Iorio <arete74@gmail.com
>(mailto:arete74@gmail.com)> wrote:
>> > Sorry for previous post
>> > Hi,
>> > i try to use couchdb for store data sensor.
>> > My document is
>> > {
>> > "_id": "a631c192ffebb7b0d543863925f4e8f9",
>> > "_rev": "1-9e8bacc2a3b79a2dc37ffeb5c53383f9",
>> > "source": "sensorbox",
>> > "location": "living room",
>> > "type": "temperature",
>> > "value": 25.3,
>> > "created": 1358270795751
>> > }
>> > I now have need to create an view for
>> > 1)average temp every hour
>> > 2)average temp every day
>> > 3)average temp every week
>> >  
>> > Is possible "recall" in avg_day the data of view avg_hour ??
>> > If yes can send me an example?
>> >  
>> > Regards
>> > Gerardo Di Iorio
>> >  
>> >  
>> >  
>> >  
>> > 2013/11/28 Gerardo Di Iorio <arete74@gmail.com
>(mailto:arete74@gmail.com)>
>> >  
>> > > Hi,
>> > > i try to use couchdb for store data sensor.
>> > > My document is
>> > >  
>> > > {
>> > > "id":"123"
>> > > "source": "
>> >  
>>  

-- 
Sent from Kaiten Mail. Please excuse my brevity.

Mime
View raw message