Fork me on GitHub
#datomic
<
2021-07-18
>
xlfe13:07:31

Using the Entity api, if I call get on a ref attribute I expect to get the referenced Entity (or a set of the same), but seemingly when the ref attribute points to an Entity with a db/ident I'm just getting a keyword (the ident) instead of an Entity object. This appears at odds with the Entity documentation though? > If an attributes points to another entity through a cardinality-many attribute, get will return a Set of entity instances. Presumably, I could call db on the original entity and then d/entity again on the keyword/ident, but is that the suggested method?

favila12:07:29

This is by design. The documentation you quote is just imprecise. This behavior is so “enum entities” are easier to work with. Your workaround is fine. Note the d/entity-db function which may make your implementation cleaner. The pull api does not do this so consider using it instead.

xlfe23:07:13

thanks @U09R86PA4 - will note your answer on my http://forum.datomic.com post and suggest an addition to the docs 🙂