You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Markus Burrer <mb...@embedit.de> on 2011/09/11 13:10:34 UTC

Writing a Bulletin Board

Hi,
I want to write a simple Bulletin Board with CouchDB (and Python). What
is more reasonable? Create a document for each post or create one thread
document and store all posts in this doc?

Thanks
Markus

Re: Writing a Bulletin Board

Posted by Aurélien Bénel <au...@utt.fr>.
Hi Markus,

> Ok, but than I need different documents for thread and post, because I need different informations for threads and posts. Or do you think it's better to put the thread informations into the first post doc?

You can do both ways. In either way you'll "collate" them.

["a0bf"]							{title:"Writing a Bulletin Board"}
["a0bf", "2011-09-11 13:10:34"]		{author:"Markus", ...}
["a0bf", "2011-09-11 13:29:46"]		{author:"Aurélien", ...}

or : 

["a0bf", "2011-09-11 13:10:34"]		{title:"Writing a Bulletin Board", author:"Markus", ...}
["a0bf", "2011-09-11 13:29:46"]		{author:"Aurélien", ...}


More information on :
http://wiki.apache.org/couchdb/View_collation


Regards,

Aurélien

Re: Writing a Bulletin Board

Posted by Nicholas Orr <ni...@zxgen.net>.
one first post (thus thread creation) you could create a thread and post
doc, on the post doc store the thread_id.

then a view could be by thread_id & post_create_date. The 1st post would be
the author, or you could put that info in the thread doc.

now you can find all posts belonging to a thread and like wise find all
threads, even put threads in categories...

thread: {_id:"thread1", categories: ["cat_id_1", "cat_id_2"], title: "My
Thread"}
post: {_id:"post1", created_at:"2011-01-01 12:34:09T1000", title: "My Post",
body:"a interesting message", thread: "thread1", author:"person_id"}

pretty much start coding and see what happens :)

Nicholas Orr


On Sun, Sep 11, 2011 at 9:52 PM, Markus Burrer <mb...@embedit.de> wrote:

> Am 11.09.2011 13:29, schrieb Aurélien Bénel:
> >> I want to write a simple Bulletin Board with CouchDB (and Python). What
> >> is more reasonable? Create a document for each post or create one thread
> >> document and store all posts in this doc?
> > I suppose there is a high probability for concurrent posts, therefore I
> think storing them as different documents would be safer.
> >
> Ok, but than I need different documents for thread and post, because I
> need different informations for threads and posts. Or do you think it's
> better to put the thread informations into the first post doc?
>
> Regards
> Markus
>

Re: Writing a Bulletin Board

Posted by Markus Burrer <mb...@embedit.de>.
Am 11.09.2011 13:29, schrieb Aurélien Bénel:
>> I want to write a simple Bulletin Board with CouchDB (and Python). What
>> is more reasonable? Create a document for each post or create one thread
>> document and store all posts in this doc?
> I suppose there is a high probability for concurrent posts, therefore I think storing them as different documents would be safer.
>
Ok, but than I need different documents for thread and post, because I
need different informations for threads and posts. Or do you think it's
better to put the thread informations into the first post doc?

Regards
Markus

Re: Writing a Bulletin Board

Posted by Aurélien Bénel <au...@utt.fr>.
> I want to write a simple Bulletin Board with CouchDB (and Python). What
> is more reasonable? Create a document for each post or create one thread
> document and store all posts in this doc?

I suppose there is a high probability for concurrent posts, therefore I think storing them as different documents would be safer.

Regards,

Aurélien