Hi Barry,

There are three ways to select data out of a view...

A specific key: ?key=["foo"]

A number of specific keys: keys=[["foo"], ["bar"], ["baz"]] (Which is passed in as user data on a POST request.

A contiguous region of keys, delimited by startkey and endkey.

If you have a view where each key looks like [$type, $date], then any docs having a particular type will be adjacent to one another.

startkey=[$type] (with no second element) will be lexicographically LOWER than any [$type, $date] key.

endkey=[$type, {}] (the second element is an empty object) will be lexicographically HIGHER than any [$type, $date] key, as long as $date is a string.

Does that work for you? The result set will still be ordered by $type then $date (although with the above startkey and endkey every record will have the same $type)

HTH,
-PB



On 22/02/2010 9:32 AM, Barry Wark wrote:
Is there a reason you can't alos create a view indexed by date then type?

Barry



On Feb 21, 2010, at 2:04 PM, David Van Couvering
<[email protected]> wrote:

I have a view that generates a type and a date as a composite key.
This way
the results are sorted by type and then by date.

I would like to call the view so that I get all rows that match a given
type, regardless of date. I need them sorted by date.

Is this possible? I've tried varying syntaxes to no success. I'd prefer
not to generate separate views for each type, but I'll do that if
that's the
only approach.

Thanks!

David

--
David W. Van Couvering

http://www.linkedin.com/in/davidvc
http://davidvancouvering.blogspot.com
http://twitter.com/dcouvering

Reply via email to