Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic set-based operaions using a document database (noSQL)
    primarykey
    data
    text
    <p>As with most, I come from and RDMS world trying to get my head around noSQL databases and specifically document stores (as I find them the most interesting).</p> <p>I am try to understand how to perform some set-based operations using a document database (I'm playing with RavenDB).</p> <p>So as per my understanding:</p> <ul> <li><strong>Union</strong> (as in SQL UNION) is very straight forward append. Additionally unions between different sets (SQL JOIN) can be achieved map/reduce. The example given in the RavenDB mythology book with Comment counts on Blogs entries is a good start.</li> <li><strong>Intersection</strong> can be performed using a number of techniques from de-normalization right through to creating a “mapping” or “link” document as described <a href="http://groups.google.com/group/ravendb/browse_thread/thread/915e11613c58f738/22a45073297d588d?pli=1" rel="nofollow">here</a> (and the aggregator example below). In an RDMS this would be performed using a simple "INNER JOIN" or "WHERE x IN"</li> <li><strong>Subtract</strong> (Relative Complement) is where I am getting stuck. In an RDMS this operation is simply a "WHERE x NOT IN" or a "LEFT JOIN" where the joined set is NULL.</li> </ul> <p>Using a real world example let’s say we have an RSS aggregator (such as Google Reader) which has millions if not billions of RSS entries with thousands of users, each tagging favourite, etc.</p> <p>In this example we focus on entry, user and tag; where tag acts as a link between user and entry.</p> <pre><code>user {string id, string name /*etc.*/} entry {string id, string title, string url /*etc.*/} tag {string userId, string entryId, string[] tags} /* (favourite, read, etc.)*/ </code></pre> <p>With the above approach it is easy to perform the intersection between entry and user using tag. But I cannot get my head around how one would perform a subtract. For instance “Return all items that do not have any tags” or even more daunting “return the latest 1000 items without any tag”.</p> <p>So my question:</p> <ul> <li>Can you point me to some reading material on the matter? </li> <li>Can you share some ideas on how one can accomplish the task <strong>efficiently</strong>?</li> </ul> <p><em>Note: I know that you lose query flexibility with document databases, but surely there must be a way to do this?</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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