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 <[email protected]> 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
> [email protected]
> 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