Note that there are some explanatory texts on larger screens.

plurals
  1. PODocument Database Design For Forum
    text
    copied!<p>I'm putting together a simple forum as a way to dip my toe into document dbs - thinking that it would be relatively straight forward thing to model.</p> <p>I'm having trouble figuring out exactly how the documents should be stored. Using RavenDB at the moment but I'd imagine it's going to be similar for other doc. dbs.</p> <p>So basically, there are <code>Forums</code> and each forum has a bunch of <code>Threads</code> and each thread contains a bunch of <code>Posts</code> which are authored by <code>Users</code>.</p> <p>In my head I have it plotted out as having each of these be distinct documents, mainly because each <code>Forum</code> could have thousands of <code>Threads</code>, and each <code>Thread</code> could have thousands of <code>Posts</code>. Having non-distinct documents it seems would cause them to become massive over time?</p> <p>When viewing a page that lists all the <code>Posts</code> I want to display the <code>Author</code> name (no big deal) and the <code>Author</code> post count. Here is where I'm stuck.</p> <p>I can store the <code>Author</code> name in the post as it's unlikely to change, however the <code>Author</code> post count is going to constantly change, so this cannot be stored within the <code>Post</code>.</p> <p>So now if I'm displaying a page with 50 posts, I need to perform the relational equivalent of a join to get the current <code>Author</code> post count. This indicates to me I'm doing it wrong, unless a document DB is just not a good fit for this scenario?</p> <h2>Edit</h2> <p>Looks like <a href="http://ayende.com/Blog/archive/2010/10/14/ravendb-ndash-live-projections-or-how-to-do-joins-in.aspx" rel="nofollow">Live Projections</a> in RavenDB should handle this just fine but I'd still like to field some comments on possible alternative DB designs.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload