From couchdb-user-return-520-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Tue Jun 10 21:50:25 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 43930 invoked from network); 10 Jun 2008 21:50:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2008 21:50:25 -0000 Received: (qmail 37000 invoked by uid 500); 10 Jun 2008 21:50:27 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 36984 invoked by uid 500); 10 Jun 2008 21:50:27 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 36973 invoked by uid 99); 10 Jun 2008 21:50:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 14:50:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ryszard.szopa@gmail.com designates 209.85.128.185 as permitted sender) Received: from [209.85.128.185] (HELO fk-out-0910.google.com) (209.85.128.185) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 21:49:35 +0000 Received: by fk-out-0910.google.com with SMTP id 19so1808785fkr.12 for ; Tue, 10 Jun 2008 14:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=7xcrGKObsg9+4WlREU6fKoMja6Z0GmLYIotET51YehU=; b=uUgHJnjUVOPnYMd0UkijOrSy8as3L0cBiAxApBVoiWGKR3UBA+HXXB3XruAdyX9T2i Pa6vUaV0IV/CJh2wzYUlr1Ya653/4Mkg77nF2Y2dqVpiyoGzxsjt7HSmPbLKzphmxRSX 1n/dm26YAjTb3U6S5MxeLsuWdtL36gv5uE108= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=IzFb5gJ5+cyrubJV2C1hO3N3by2LWktPVFgLAPlgirxOJ6Mq+gn7NZ6mcCFCEJTX6F YBanVPBapAGgQhq4cIDNoSYePiTXiN+ircHQeuERao4oEp10DWA58T1ySYDmLVq/UQN6 AB2tzJG8tLGUUZKQk6iacyWu8NcKubZBb8J/k= Received: by 10.82.151.9 with SMTP id y9mr378214bud.8.1213134591567; Tue, 10 Jun 2008 14:49:51 -0700 (PDT) Received: by 10.82.116.6 with HTTP; Tue, 10 Jun 2008 14:49:51 -0700 (PDT) Message-ID: <19e19e410806101449n707154c6q41d13133281f1407@mail.gmail.com> Date: Tue, 10 Jun 2008 23:49:51 +0200 From: "Ryszard Szopa" To: couchdb-user@incubator.apache.org Subject: grouping results by keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Hi, Right now some quite basic things are rather difficult in CouchDB. For example, if we had a database with car objects that have brands and models, there's no straightforward way of finding all the different car models or brands. This could become very simple if there was a possibility of grouping results by keys. This could be implemented in the following way: * View-objects could have an additional attribute, "group", which would contain a function taking two arguments: a key and a list of values * After the map phase, the "group" function would be called on each different key and the list of objects that had this key * The reduce phase would be done after the group phase. This could also work very well with view collation. Cheers, -- Richard PS. Please forgive me being that guy that asks for new features all the time... -- http://szopa.tasak.gda.pl/