Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FC437EB1 for ; Tue, 4 Oct 2011 16:38:19 +0000 (UTC) Received: (qmail 79461 invoked by uid 500); 4 Oct 2011 16:38:17 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 79427 invoked by uid 500); 4 Oct 2011 16:38:17 -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 79419 invoked by uid 99); 4 Oct 2011 16:38:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 16:38:17 +0000 X-ASF-Spam-Status: No, hits=4.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,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 sean.copenhaver@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, 04 Oct 2011 16:38:12 +0000 Received: by yxm34 with SMTP id 34so951221yxm.11 for ; Tue, 04 Oct 2011 09:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oVI6aDJJb+bn/9gi9SaIV6syBVCP8o/SA4qlB5kf0aA=; b=IWcUKExzlCTzLdYAoUhVKT3VpLCZKo8P1Nqw/TUx2eyEZPbo7GxeyHRGSzAXzG+TM4 cRHY1hMSbrDxSmtBSzyDHlzK0nywZzk2Z8CgVo2fNCAjyTgNKKOO1W1fot0OGbQWEjDx 2H+OnSAaVYvgozS2h668MTkYd2BScDoluucg0= MIME-Version: 1.0 Received: by 10.42.18.198 with SMTP id y6mr2147592ica.189.1317746271837; Tue, 04 Oct 2011 09:37:51 -0700 (PDT) Received: by 10.42.139.195 with HTTP; Tue, 4 Oct 2011 09:37:51 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Oct 2011 12:37:51 -0400 Message-ID: Subject: Re: views sorted by array values From: Sean Copenhaver To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf301d41b66fde9504ae7bb68b --20cf301d41b66fde9504ae7bb68b Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Do you have any example queries you are wanting? Are the categories hierarchical? A map function of: function (doc) { if (doc.type !=3D=3D "product") return; //pretty sure forEach() is supported doc.categories.forEach(function (cat) { emit(cat, null); }); } would let to retrieve things like "all products with a category of '1'" something like a query parameter of: ?key=3D1 On Tue, Oct 4, 2011 at 12:23 PM, Ron Dyck wrote: > I'm new to creating views in couched and have a question. I have a number > of > documents with the type : product > Each of these documents has an array with various values: categories : [1= ], > categories : [1,3], categories : [1, 3, 8] =85 etc. > > My question is, how do I sort or create a view based on a specific catego= ry > ? > > You help is appreciated > > -- > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Ron Dyck > pulpfree1@gmail.com > www.webbtech.net > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --=20 =93The limits of language are the limits of one's world. =93 - Ludwig von Wittgenstein "Water is fluid, soft and yielding. But water will wear away rock, which is rigid and cannot yield. As a rule, whatever is fluid, soft and yielding wil= l overcome whatever is rigid and hard. This is another paradox: what is soft is strong." - Lao-Tzu --20cf301d41b66fde9504ae7bb68b--