Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to store references to arbitrary entities in RavenDB?
    primarykey
    data
    text
    <p>I have the need to store arbitrary references to entities within my Raven Database. Sometimes the entity is an aggregate root (see Events below) and other times it is a value entity (see Sessions below). I'm currently planning to store the references as Lucene queries (or a Lucene-like syntax.) Has anyone done anything like this? Am I heading down a difficult path?</p> <p>Some of my concerns are:</p> <ul> <li>Value entities are unlikely to provide identifiers, can I expect to reliably reference value entities?</li> <li>Individual entities should be unaware of (decoupled from) the Arbitrary Relationship infrastructure, what is the best way to infer the queries from complex object graphs?</li> <li>Limiting the relationships to only Aggregate roots (and preventing references to value entities) would simplify the problem, but it would require me to restructure my Event/Session documents. I'd like these two systems to remain decoupled (concerns of one should not impact the other.)</li> </ul> <p>I've included example documents below to illustrate my scenario. Any thoughts, ideas, guidance, or examples would be very appreciated.</p> <pre><code>Events Collection { Id: “30f6...54a7”, Title: “Annual Meeting” Sessions: [ { Code: “COM001”, Title: “Opening Ceremony” }, { Code: “TEC201”, Title: “Intermediate Tech” } ] } People Collection { Id: "45a8...f209", Name: "Chad" } Arbitrary Relationships Collection { Id: “b613...8ebb”, SubjectEntityQuery: "People.Id:45a8...f209", TargetEntityQuery: “Events.Id:30f6...54a7.Sessions,Code:COM001”, Action: "Attended Session", Story: "Chad attended the Opening Ceremony session" } </code></pre> <p><strong>Edit</strong></p> <p>I'd like to give more detail on the arbitrary relationships. We will have the ability to extend the system to respond to system events and record the interaction between two entities. We have many more entities than Events, Sessions, and People. The relationship may be a person sharing a link or a tweet about a hashtag. Effectively, the Arbitrary Relationships collection becomes a graph-like structure that allows us to see all ~interactions~ for a given entity.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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