couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Burton" <>
Subject RE: Get all documents of a certain type.
Date Tue, 06 Nov 2012 22:36:27 GMT
I am trying to learn Couch so what doesn't make sense of the "or"?

-----Original Message-----
From: Dustin Sallings [] 
Sent: Tuesday, November 06, 2012 4:11 PM
Subject: Re: Get all documents of a certain type.

"Kevin Burton" <>

> In my Couch database I have a mixture of documents. The documents that 
> I am interested in have an Id of 'product-xxxxxxx' or 'order-xxxxxx'. 
> The "product" documents have a property of SKU that is a string. I 
> would like to form a query to get a list of all the product SKUs. Does 
> this require a view in the design document or can it be done all in one
request? Thank you.

  Your "or" doesn't make sense there.  You can do it with or without a view
and in either case you can do it in one request.

  It looks like you can probably just use alldocs with a start and end key
specified limiting to the doc IDs that start with "product-".

  You could also build a view that maps sku -> [something] for all documents
of type product and then traverse that.  The value could be null, or
something you might want to know when looking at a sku.

  Or if you have different ways of looking at products, you could use that
as the key and the sku as the value and chop it up more neatly from there.


View raw message