On Sun, Nov 23, 2008 at 10:57 PM, Jedediah Smith <[EMAIL PROTECTED]> wrote: > I'm using CouchDB to store and process emails. > > Every email has a "message-id" header field containing a globally unique > identifier and zero or more "references" and "in-reply-to" fields, each of > which contains the message-id of a different message.
You might have the easiest time providing this view if you can have an original-message-for-thread-id that is attached to all messages that are replies or references to another message. That way you can pull out an entire thread by finding all messages that reference the thread-originating message in the parent field(s). The method you describe (where each message links only to its immediate parent) leaves you no common identifier for an entire thread. By linking to the first message in a thread, from all subsequent replies, you'll have an easy way to pull all replies together in one view. I hope this helps. Chris -- Chris Anderson http://jchris.mfdz.com