Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 53351 invoked from network); 5 Mar 2010 00:28:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Mar 2010 00:28:52 -0000 Received: (qmail 57785 invoked by uid 500); 5 Mar 2010 00:28:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 57663 invoked by uid 500); 5 Mar 2010 00:28:39 -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 57655 invoked by uid 99); 5 Mar 2010 00:28:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 00:28:39 +0000 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=HTML_FONT_FACE_BAD,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cscott@gmail.com designates 209.85.210.177 as permitted sender) Received: from [209.85.210.177] (HELO mail-yx0-f177.google.com) (209.85.210.177) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 00:28:31 +0000 Received: by yxe7 with SMTP id 7so1577048yxe.3 for ; Thu, 04 Mar 2010 16:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=tXt+bHtF6pisJXiqTwBb6bozNwvU37Mp52T7XP53D3o=; b=KQ0MZih6SVvRE9bfQkkQdbMdpjT5BXrwXiRqFFeCEzW6D5ncVUjJgcAs34OApsK3ws XyPvotdJIKY/GB6HS1zQJuEsYiLWbDXoZ/r6q1dz9wjABZmuTSY1iprYhKtyvlFEA+z9 mpTP73N7XHVdKlfkUT3Fb081drBwzWyqg3Bks= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HG5Ldu3nw8zPOGcGUdN4jet7On7hzwVyiZHIwLx8Jq1L61MRN/r1No/hLJh4/gyK2t uVbs37RFm0/y/FGr16HZuUwSYX0+N3cTyju3flYhXqpRdi6lVQcOuW8XxPa3ATuOw6PR iSb8JSeIBbs8wBh0rdNDfTY9U0Lpjm4ayO2NM= MIME-Version: 1.0 Received: by 10.100.224.13 with SMTP id w13mr572518ang.139.1267748888012; Thu, 04 Mar 2010 16:28:08 -0800 (PST) Date: Thu, 4 Mar 2010 16:28:07 -0800 Message-ID: <9e4ef4d1003041628o3cbd4308yf5c907dcaafb06cf@mail.gmail.com> Subject: Views and AND/OR-like Functionality From: Cy Scott To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=00163623ac9222844b048102ca9c X-Virus-Checked: Checked by ClamAV on apache.org --00163623ac9222844b048102ca9c Content-Type: text/plain; charset=ISO-8859-1 Just getting started with CouchDB (loving it btw) and am wrapping my brain around the views. I've seen mention that CouchDB doesn't really handle ANDing or ORing a la SQL, but is there some way to emulate it? Here's an example scenario. Say I have documents for different sweaters in the form of (with _id, _rev, etc.): { "color": "Red", "size": 4, "price": 8.00 } My data has sweaters of different colors, sizes and prices. The problem I'm having is when I want to get data for different permutations like: ALL blue and red sweaters that are size 5 or ANY green sweaters under $30. I've tried complex keys [doc.color, doc.size, doc.price] but don't know if this is the right direction. My simple map function looks like function(doc) { if(doc) emit([doc.color, doc.size, doc.price], null); }; | key | value |---------------------------- |["Blue", 5, 15] | null |["Green", 4, 25] | null |["Red", 5, 10] | null Anyone have any thoughts on how to best implement this type of scenario? Or links to some info, previous thread that might have covered this. Appreciate any and all help! --00163623ac9222844b048102ca9c--