Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 78681 invoked from network); 8 Feb 2011 23:35:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2011 23:35:28 -0000 Received: (qmail 37060 invoked by uid 500); 8 Feb 2011 23:35:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 37016 invoked by uid 500); 8 Feb 2011 23:35:26 -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 37006 invoked by uid 99); 8 Feb 2011 23:35:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 23:35:26 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jjfutbol@gmail.com designates 209.85.213.180 as permitted sender) Received: from [209.85.213.180] (HELO mail-yx0-f180.google.com) (209.85.213.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 23:35:21 +0000 Received: by yxd30 with SMTP id 30so2706472yxd.11 for ; Tue, 08 Feb 2011 15:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=d7qZiWqGBBiq+rgYlopLtzF/ATHnUtOO7HxyC7OnF1U=; b=CJyuPPqycpfstBwjx+mp2FPTBbYWjBd3alPFiCdXtA63FyJwJ2pVRy7ilS1BcWB4F9 NA+CeQ/WOgUd4bORyh3greeLoeY038UjrxN9tX3ZYm4uwfW9dJvUEMTzEjxO6HcEsK93 udKtPowxKTaDVMNMGJOY1LyXLf366Ys6T8MdE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=C5FBOTUiW0COGCYdiQ5Y1wbwTWU/PkjckB+QUVI38DkUoZRXfaqebkJcQy8y18SIAc m4hIDVvUfO6Y3otXkutKfN3ttMx79Ltamy7AcOmIqhNG6nefcZx5hKn0SpbyFgIYOtXP EStZJvE5azj5PbGO27WGIiR0yKgOOCZRAhIVg= Received: by 10.90.71.3 with SMTP id t3mr585658aga.112.1297208098234; Tue, 08 Feb 2011 15:34:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.91.153.12 with HTTP; Tue, 8 Feb 2011 15:34:38 -0800 (PST) From: Javier Julio Date: Tue, 8 Feb 2011 18:34:38 -0500 Message-ID: Subject: Query a view with id list but for one key To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=00163630f2b7e5203a049bcdcb11 --00163630f2b7e5203a049bcdcb11 Content-Type: text/plain; charset=ISO-8859-1 Hey all, I've been reading on and using CouchDB since December last year. It's been great and I've gotten my head around it quite well but on some harder tasks I'm struggling a little. Let me talk about what I'm currently doing. I'm using CouchDB for a social app where users can save places. The same place can be stored in the db multiple times since its tied to a user. Each place has a unique id. Since this is a social app, say if User A has various friends and they have saved the same place, I'd like have a view where I can get a list of those friends. Think like in Facebook when you have a comment or status update and a bunch of people "like" it, you'd see something like "You and 5 others like this". When you click on that link you'll get a list of those people's names. I can easily create a view that has a map function that just emits the document id, place id, and user id. The problem I have figuring out is if I have an id list of User A's friends how can I pass that into the view? From what I know this doesn't seem like how it works. I'm most likely approaching this wrong and thinking to much about how I would do this with SQL (basically using a WHERE IN statement). Any suggestions? While I just could have the view return all places saved by anyone else but that seems excessive because there is definitely the potential that many people have that place saved that aren't even that users' friend. Ciao! Javi -- Javier Julio Senior Software Developer, 9mmedia www.javier-julio.com --00163630f2b7e5203a049bcdcb11--