Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 97684 invoked from network); 15 Oct 2010 07:10:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Oct 2010 07:10:51 -0000 Received: (qmail 58821 invoked by uid 500); 15 Oct 2010 07:10:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 58431 invoked by uid 500); 15 Oct 2010 07:10:46 -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 58423 invoked by uid 99); 15 Oct 2010 07:10:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Oct 2010 07:10:45 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of terrybrownell@gmail.com designates 209.85.161.180 as permitted sender) Received: from [209.85.161.180] (HELO mail-gx0-f180.google.com) (209.85.161.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Oct 2010 07:10:39 +0000 Received: by gxk9 with SMTP id 9so237657gxk.11 for ; Fri, 15 Oct 2010 00:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=/s7PZu8b1mHlJgKPcuOHOA8yzKYsUBuuHEKOfWt0JvQ=; b=KdQ1oVl0FngARF3aI2FWnbWPI2TPbtos2CtFl4DvajPYHU0VNccP6m7rh/4Xk6ZmUo kBExudTOws6BrNHh0wxdefWct1KM+t5W0APQ+VSnqBKihdjFT3qE6NQ2/ri2mJaE051z R80CDq/HD1jbbYNNeijtvuuCtoNXYUDOtOJ6k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=tUfy4LDSw4HEL9IvuKdpTixDvSQh2oytuU1ItkhCZynFDzujmol8g2acj2Mkn0SkmI HMVEXVmPKOryG+ghIb64Y4Hw5FJ0bWNh5CyubOqKUXb/mWJziAoIAcTSaa1kbVh0xkSQ i3H6ARdvre/xLPg8tS+eC8VeFMmrYUs6QBAys= MIME-Version: 1.0 Received: by 10.150.57.17 with SMTP id f17mr1058134yba.111.1287126615957; Fri, 15 Oct 2010 00:10:15 -0700 (PDT) Received: by 10.150.135.3 with HTTP; Fri, 15 Oct 2010 00:10:15 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 Oct 2010 00:10:15 -0700 Message-ID: Subject: Re: Cooking up Views From: Terry Brownell To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=000e0cd305a8b9a0360492a284da --000e0cd305a8b9a0360492a284da Content-Type: text/plain; charset=ISO-8859-1 Thanks Paul, Here's another question. Let's say i expand the "isa" property to contain an array... { "_id": "tweety", "isa": ["bird", "pet", "target"], "_rev": "3-d085e60568133d80a96cd735c6c306f6", "color": "Yellow", "nemesis": "Sylvester" } And say all my docs have various "isa" (or tags) values.. does this mean I need to put the values in specific order and know this order in advance to find them? ie: http://127.0.0.1:5984/dbname/_design/ddocid/_view/view_name?key=["bird", "pet" "target"] Terry On Thu, Oct 14, 2010 at 4:19 PM, Paul Davis wrote: > Terry, > > // map.js > function(doc) { > if(!doc.isa || !doc.color || !doc.nemesis) return; > emit([doc.isa, doc.color], doc.nemesis); > } > > // Query URL > http://127.0.0.1:5984/dbname/_design/ddocid/_view/view_name?key=["bird", > "yellow"] > > HTH, > Paul Davis > > On Thu, Oct 14, 2010 at 7:07 PM, Terry Brownell > wrote: > > Hi, attempting to port my semantic network DB to CouchDB, but I'm not > > grokking the more complicated views, and in particular passing variables. > > > > Looking for a cookbook recipe for creating a view (against the documents > > below), that... > > > > - Selects all documents where "isa" = "bird", that has a "nemesis", and > > color is a variable ie: all yellow? > > > > > > { > > "_id": "tweety", > > "isa": "bird", > > "_rev": "3-d085e60568133d80a96cd735c6c306f6", > > "color": "Yellow", > > "nemesis": "Sylvester" > > } > > > > { > > "_id": "Sweetie Pie", > > "isa": "bird", > > "_rev": "3-d085e60568133d80a96cd735c6c306f6", > > "color": "Yellow" > > } > > > > { > > "_id": "Woody", > > "isa": "bird", > > "_rev": "3-d085e60568133d80a96cd735c6c306f6", > > "color": "Blue", > > "nemesis": "Buzz Buzzard" > > > > } > > > > Thanks > > > --000e0cd305a8b9a0360492a284da--