On Thu, Jan 6, 2011 at 3:26 PM, He Shiming <[email protected]> wrote:

> Thanks Martin. I actually read those. The key can be a JSON array.
> However, in my situation I only wanted to sort by the date, I didn't
> really want to specify a date in the first type query. Do you have an
> example of what this complex key should look like when querying?
>

To sort by date you should emit( [doc.user_group, doc.updated_at], doc.type)
- however documents will still be sorted by user group first.

With such keys you query a perticular date range by providing, for instance,
startkey=["developers",2011-01-04]&endkey=["developers",2011-02-04]
(url-encoded)

You will still be able to do simple queries like : key=["developers"]

If you need to filter documents with updated_at only, another view where
updated_at is the single key is a better option.


HTH,

Martin

Reply via email to