Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 60901 invoked from network); 12 Dec 2009 20:39:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Dec 2009 20:39:40 -0000 Received: (qmail 93982 invoked by uid 500); 12 Dec 2009 20:39:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 93894 invoked by uid 500); 12 Dec 2009 20:39:38 -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 93884 invoked by uid 99); 12 Dec 2009 20:39:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Dec 2009 20:39:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pawelstawicki@gmail.com designates 209.85.219.216 as permitted sender) Received: from [209.85.219.216] (HELO mail-ew0-f216.google.com) (209.85.219.216) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Dec 2009 20:39:30 +0000 Received: by ewy8 with SMTP id 8so2245055ewy.35 for ; Sat, 12 Dec 2009 12:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=Sjbf6W4kYHRU20YKXXDMaGUa0GPqsvjsxWGwTSnsRqI=; b=j598NpZ41T1s0SFL3st1DUGIzHlbbt+MV8dWw9/fnyUXakzWxiKAinypR+TmmaLUgk xVtkjP6DBBxi8cdAV4n2Qv6mEiEoXL5J1fMcxAnuEC1H2tYRW096pqWAsB2YeQVviJck WfuU4yroSElrOJTRrqWH88RbmmSXz0Qx0f7Mw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=pOxBKnrBKTLUssf4wf4w8cTTQq8ucv7Htf9rd85q01iva0tnYW9rl34GP7sZNBPkUO /5AxbQW1WtA7gFK10x3FXFsyC8ulpHbx8/n8oCOVp61LdtiDLLpYHaKnyASztrKN2L60 EX7cOGCpqaVWOpkt4IbojLsiMsdOcomubSWwU= MIME-Version: 1.0 Received: by 10.213.96.195 with SMTP id i3mr3328529ebn.97.1260650349100; Sat, 12 Dec 2009 12:39:09 -0800 (PST) From: =?UTF-8?Q?Pawe=C5=82_Stawicki?= Date: Sat, 12 Dec 2009 21:38:49 +0100 Message-ID: <6adfa88d0912121238p3d31e20bn710d23357f80656e@mail.gmail.com> Subject: How to make equivalent of WHERE on JOINed table in CouchDB? To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Crossposting from stackoverflow.com. Assume we have two kind of documents in CouchDB. Person and Car: Person: _id firstname surname position salary Car: _id person_id reg_number brand So there is one to many relationship. One person can have many cars. I can construct map function to get every person and his/her car next to each other. In such case key is array [person.id, 0] and [car.person_id, 1]. What I can't do, is limiting this view to owners of specific brand only, e.g. if I need salaries of owners of Ferrari. So set of documents (persons) is limited by related documents (cars). How can I do it? Best regards -- Pawe=C5=82 Stawicki http://pawelstawicki.blogspot.com http://szczecin.jug.pl http://www.java4people.com