Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5C58CBBA0 for ; Fri, 20 Jan 2012 08:12:06 +0000 (UTC) Received: (qmail 29215 invoked by uid 500); 20 Jan 2012 08:12:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 28852 invoked by uid 500); 20 Jan 2012 08:12:02 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 28844 invoked by uid 99); 20 Jan 2012 08:12:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 08:12:00 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.27.42.3] (HELO smtp3-g21.free.fr) (212.27.42.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 08:11:52 +0000 Received: from [192.168.0.25] (unknown [82.224.138.202]) by smtp3-g21.free.fr (Postfix) with ESMTP id 34469A66BA for ; Fri, 20 Jan 2012 09:11:24 +0100 (CET) Message-ID: <1327047073.2079.1.camel@Thomas> Subject: Grouping a view on a key not provided in the request From: Thomas Boniface To: user@couchdb.apache.org Date: Fri, 20 Jan 2012 09:11:13 +0100 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.2 (3.2.2-1.fc16) Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Hi, First of all I apologies if I duplicate my post but I didn't see my mail from yesterday pop out on the list. So here it is again :) I am looking into implementing a system that would use as input a high volume of apaches logs in order to produce reports used on a stats website (table, graph...). The main requirement is to be low latency as this is the reason we want to get rid of mysql currently not doing the job properly. This lead me to study various nosql databases, but Couch DB was the one that caught my attention most. It's easy to setup and play with also the incremental view seemed to really fit my needs. It allowed me to easily import my existing data and start experimenting with views what leads me here today. I am struggling to write a particular type of view and hope I can find some guidance here... To summarize here is what I am trying to achieve: my database is filled with requests containing (among other things) datetime and client_id. The view I'm trying to write should display the number of occurrences for a date range grouped by client_id. Unfortunately I don't manage to create a view that would contain the expected result with the right format. The closest I could do was producing a result as follow: [2009, 11, 19, 61] => 14 [2009, 11, 20, 61] => 30 [2009, 11, 20, 64] => 30 ... This represents 14 occurences for the client 61 on the 2009-11-19, 30 on the 2009-11-20 and so on. What I would like to retrieve is a resulted grouped on client id to avoid having multiple rows for the same client id) The view is called with startkey=[2011,11,1]&endkey=[2011,11,30,{}]&group=true&stale=ok This is important for me because not being able to group mean I am getting a "row" per day per client what leads to a response to big a makes the latency to big on front. Thanks, Thomas