couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: couchdb teporaly average view
Date Fri, 29 Nov 2013 10:58:13 GMT
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> 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>
>
>> Hi,
>> i try to use couchdb for store data sensor.
>> My document is
>>
>> {
>>    "id":"123"
>>    "source": "
>>
>>

Mime
View raw message