couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Dyck <pulpfr...@gmail.com>
Subject Re: views sorted by array values
Date Tue, 04 Oct 2011 17:04:27 GMT
Did the trick, thank-you!

On Tue, Oct 4, 2011 at 12:37 PM, Sean Copenhaver
<sean.copenhaver@gmail.com>wrote:

> Do you have any example queries you are wanting? Are the categories
> hierarchical?
>
> A map function of:
> function (doc) {
>    if (doc.type !== "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=1
>
> On Tue, Oct 4, 2011 at 12:23 PM, Ron Dyck <pulpfree1@gmail.com> 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] … etc.
> >
> > My question is, how do I sort or create a view based on a specific
> category
> > ?
> >
> > You help is appreciated
> >
> > --
> > =================
> > Ron Dyck
> > pulpfree1@gmail.com
> > www.webbtech.net
> > =================
> >
>
>
>
> --
> “The limits of language are the limits of one's world. “ - 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
> will
> overcome whatever is rigid and hard. This is another paradox: what is soft
> is strong." - Lao-Tzu
>



-- 
=================
Ron Dyck
pulpfree1@gmail.com
www.webbtech.net
=================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message