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 858E27B88 for ; Wed, 17 Aug 2011 07:10:58 +0000 (UTC) Received: (qmail 9208 invoked by uid 500); 17 Aug 2011 07:10:54 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 8079 invoked by uid 500); 17 Aug 2011 07:10:36 -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 7772 invoked by uid 99); 17 Aug 2011 07:10:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Aug 2011 07:10:31 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of greenrover33@gmail.com designates 74.125.82.54 as permitted sender) Received: from [74.125.82.54] (HELO mail-ww0-f54.google.com) (74.125.82.54) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Aug 2011 07:10:22 +0000 Received: by wwg11 with SMTP id 11so661742wwg.23 for ; Wed, 17 Aug 2011 00:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=gqVEeCMKVvleUWrasyMbMxEqvXNZnPej1pw27wtw9Z0=; b=DT5n+Jam4Dv0wIHQAgrAgWb5cdbOeEbP7KJ48cnQuyZhPymTgMPlC64UZlOUmWK7AP fjzPAg9sJpIwB5DW0y/X3NjI1QSClL+fugVUiGuK7cP7UJMCW+FM3ycO9+ltdtKC7r/e U2z54m6EBKyhiG3Woy+fg9cZTUrItag9K2cSo= Received: by 10.227.57.68 with SMTP id b4mr515198wbh.82.1313565001188; Wed, 17 Aug 2011 00:10:01 -0700 (PDT) Received: from hhTestSys.MBESFIB01.local ([78.110.143.226]) by mx.google.com with ESMTPS id fd4sm662337wbb.13.2011.08.17.00.09.59 (version=SSLv3 cipher=OTHER); Wed, 17 Aug 2011 00:10:00 -0700 (PDT) Message-ID: <4E4B6946.1030504@gmail.com> Date: Wed, 17 Aug 2011 09:09:58 +0200 From: Heiko Henning User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110627 Thunderbird/5.0 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: map reduca with object as key Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hy, i have create some demo pages like this: { "_id": "rating_1", "type": "rating", "value": 90, "user": "max@educa.ch", "lom_id": "1337" } And a design document like: { "_id": "_design/rating", "views": { "get_rating": { "map": " function(doc){ if (doc.type == 'rating') { emit({user:doc.user, lom_id:doc.lom_id}, doc.value); emit({user:'all', lom_id:doc.lom_id}, doc.value); } } ", "reduce": " function(key, values, rereduce){ var result = new Object(); if(!rereduce) { return sum(values)/values.length; } return sum(values); } " } } } When i view this with _utils, i will get: http://picupload.org/i/2bd364369222.jpg But a query like: key = {"lom_id":"1337","user":"all"} http://ubuntu:5984/testdb/_design/rating/_view/get_rating?group=true&key={%22lom_id%22%3A%221337%22%2C%22user%22%3A%22all%22} retrun only a rows:[] Question: Is there a possibility to have key as Object? Or have i to do thinks like: emit(doc.lom_id+'___'+user:doc.user, doc.value); emit(doc.lom_id+'___all', doc.value); Frindly Regards Heiko