| From | Sent On | Attachments |
|---|---|---|
| Harald Lapp | Oct 8, 2009 11:58 pm | |
| Mitch Pirtle | Oct 9, 2009 6:52 am | |
| Mark Fletcher | Oct 9, 2009 6:56 am | |
| Mathias Stearn | Oct 9, 2009 7:38 am | |
| Harald Lapp | Oct 10, 2009 11:48 am |
| Subject: | Re: difficulties finding the right data model for a forum | |
|---|---|---|
| From: | Mitch Pirtle ("mit...@gmail.com) | |
| Date: | Oct 9, 2009 6:52:06 am | |
| List: | com.googlegroups.mongodb-user | |
I'd create it this way, and would love to hear what others would do:
Each forum gets its own collection, and the first object is the META information about that board (title, subject, summary, etc). The rest of the objects are all threads, with posts nested inside.
db.forum1 +-META information - title, summary, description, counts, etc +-Thread 1 +---Post 1 +---Post 2 +---Post 3 +-Thread 2 +---Post 1 +---Post 2
What do you think?
-- Mitch
On Fri, Oct 9, 2009 at 2:59 AM, Harald Lapp <hara...@gmail.com> wrote:
hello,
so we want to develop a mongodb backed forum, but we are unsure what's the right way to store our data in. i would be very pleased, if you could read our specifications and maybe you could give a hint of the right data model or what limitations there may exist. please excuse my long post, but maybe it's helpful for some other mongodb users, too.
specifications: ===============
it must be possible to store multiple independent forums -- let's say about 1000 different forums. each forum may have categories, subcategories, boards and subboards. we expect a total of several hundreds of thousands of posts for each forum. searching should be not an issue, because we will write an data exporter and use the sphinx searchengine for any searching capabilities.
data model: ===========
i'm trying to visualize the data-model as tree:
1st possibility: using 1 collection
-----------------------------------
db.forum:
+- forum 1 .. +- category 1 ..... +- board 1 ........ +- post 1 ........ +- post 2 ........... +- answer 1 ........... |. +- subanser 1 ........... +- ... ........ +- post 3 ........ +... +- forum 2 +- ...
2nd possibility: using 2 collections
------------------------------------
db.forum
+- forum 1 .. +- category 1 ..... +- board 1 +- forum 2 +- ...
db.posts
+- post 1 +- post 2 .. +- answer 1 ..... +- subanser 1 ..... +... +- post 3 +...
3rd possibility: ???
--------------------
maybe there are other possibilities we did not think of?
"views" on the data =================
the view on the forum is not an issue, but we want to have two different views for the post data: we want to visualize the postings in flat form sorted by date (sortable asc/desc), and we also want to make it possible to view the postings as tree(!)
conclusion ==========
we have many years experience with RDBMS' and so we have difficulties to think in something else than relations. there's lot of literature out there discribing normalization and de-normalization. is there something comparable for key/value or document oriented databases? does it make sense to read -- for example -- the couchdb book, when we want to use mongodb as database backend?
thank you very much for reading!!
harald





