Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 84142 invoked from network); 1 Jul 2010 20:50:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jul 2010 20:50:46 -0000 Received: (qmail 75278 invoked by uid 500); 1 Jul 2010 20:50:45 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 75230 invoked by uid 500); 1 Jul 2010 20:50:44 -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 75072 invoked by uid 99); 1 Jul 2010 20:50:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 20:50:44 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robert.newson@gmail.com designates 209.85.161.52 as permitted sender) Received: from [209.85.161.52] (HELO mail-fx0-f52.google.com) (209.85.161.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 20:50:36 +0000 Received: by fxm8 with SMTP id 8so2718010fxm.11 for ; Thu, 01 Jul 2010 13:49: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=CNLvPFxDm+ds3M+8N/S5u50x0Z7GUXXwYcJfmm3aHVs=; b=pGRHclsazOfJpo4qGxwUgZYk4ExkFXvoHoj+iBhyoEXlBPN7/L6xpkj9/kjJDi5j2Y junyvmj1CjCIRSEiVT3DpFRSLCk/MwJ41nKjBj2mUbxdywGo6vQrTrNaQibSBGcJwemv SzeDyPRmbDDJvYPcH0da2FzTITP0/GYgTRw5k= 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=f2I+nNmx7MAmKVz1k2Utjyq3AVcnidQz6M1D0OuR9pkyRc1bH/vEa+ww9Wrhyj1OMM f3uHyLFNO1JtjkEB68k5g+1pHaOes4ggBXxfczD+is8ZM7/MUyXrqG71tXJI5YWjhiRr w5aANap3mKPjs1KUG+p8E2i/s/mNKVRDVsxe0= MIME-Version: 1.0 Received: by 10.103.172.10 with SMTP id z10mr12312muo.44.1278017356482; Thu, 01 Jul 2010 13:49:16 -0700 (PDT) Received: by 10.103.224.9 with HTTP; Thu, 1 Jul 2010 13:49:16 -0700 (PDT) In-Reply-To: References: Date: Thu, 1 Jul 2010 21:49:16 +0100 Message-ID: Subject: Re: Newbie Question about View's Startkey Match From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Afshin, Unfortunately, none of your four assumptions are correct. CouchDB supports key and key range lookup only, there is no syntax for "match all arrays" or "match all objects". What you have probably seen is this trick; ?startkey=["foo"]&endkey=["foo",{}] which, in most circumstances, selects all array keys where the first item is a string of "foo". This works because shorter arrays sort before longer arrays and {} (empty object) sorts later than any possible string. As Zachary pointed out above, the view collation is described at http://wiki.apache.org/couchdb/View_collation. B. On Thu, Jul 1, 2010 at 9:30 PM, Zachary Zolton wrote: > Afshin, > > Well, if you want to just get a certain "slice" of a view's key space, > you'll want to use both the startkey and endkey parameters. > > For instance, if you just want all the view rows where the key > contains an array, try this: > > startkey=[]&endkey={} > > Any array value (e.g. ["foo"] or ["foo","bar"]) will collate at or > after the empty array (i.e. []), and since in this example you don't > want any object keys coming through we stop at the empty object (i.e. > {}). > > Is this any clearer? > > -Zach > > On Thu, Jul 1, 2010 at 3:04 PM, afshin afzali wrote: >> Thank you, I've saw this page already. My question is based on that page. >> Are you confirm my assumtions ? >> >> >> >> >> On Fri, Jul 2, 2010 at 12:26 AM, Zachary Zolton wrote: >> >>> Here's the overall ordering of collation: >>> http://wiki.apache.org/couchdb/View_collation#Collation_Specification >>> >>> On Thu, Jul 1, 2010 at 2:31 PM, afshin afzali >>> wrote: >>> > Hi Guys, >>> > >>> > These are some simple assumptions which I would be confirmed when using >>> in >>> > startkey param: >>> > >>> > 1) {} matches all object keys ( including {} ) >>> > 2) [] matches all array keys (including [] ) >>> > 3) "" (null string) matches all string keys (including "") >>> > 4) {} at the end of complex key matches all of remained ones >>> > >>> > BEST >>> > -- afshin >>> > >>> >> >