couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Davis" <>
Subject Re: how to set order in docs?
Date Thu, 17 Jul 2008 21:00:20 GMT
If you emit things in a view, they're sorted by JSON values.

Check out:

In your book example, doing something like:

emit([doc.title, doc.chapter, doc.subchapter], null) ;

would give you a view that had books ordered by chapter and
subchapter. You could also do some nice stuff with the reduce
functions to make that a "get list of books" get list of chapters for
book", etc.


On Thu, Jul 17, 2008 at 4:53 PM, Patrick Aljord <> wrote:
> Hey all,
> What's the best way to deal with ordered list of documents, like if a
> chapter has a list of sub-chapters that should be retrieved in order
> so I can sort them by first sub-chapter, second, third etc? in mysql
> that would be auto-increment I guess but how about couchdb?
> Thanks in advance,
> Pat

View raw message