Fork me on GitHub
#datomic
<
2017-11-03
>
Garrett Hopper14:11:29

@djjolicoeur Hmm, ok. So does it make sense to give A a list of B refs (cardinality/many), or give each B a ref to A?

djjolicoeur14:11:43

@ghopper it depends on how you are going to use it. I personally prefer a :cardinality/one from each B to A in most cases, given that I can get that many relation via the reverse reference on A. I just find it to be cleaner to maintain from B. My personal preference is that, if the ref is not a component entity of A, then the ref goes from B to A. I'm sure some folks may disagree with that, though.

Garrett Hopper14:11:34

Ok, that's helpful. Thank you

Garrett Hopper14:11:14

@djjolicoeur Component entity meaning all Bs are deleted when A is deleted?

Garrett Hopper14:11:48

Only if it's marked as such, of course.

djjolicoeur14:11:53

yes, that would be a consequence of having a ref from A to B where :db/isComponent is true.

Garrett Hopper14:11:03

Ok, and that could only be done with a one to many from A to Bs. Makes sense. :thumbsup:

cjmurphy23:11:27

I have an attribute and would like to query for a specific value or no value set (nil?). Is that possible? Currently I'm using a special attribute to indicate 'no value set', but want to get rid of it to reduce confusion.