Fork me on GitHub
#datascript
<
2017-07-07
>
Niki14:07:47

@kurt-o-sys references, one-to-many attributes, components and indexes

kurt-o-sys14:07:27

@tonsky ok, thx. So: refs: :db/valueType :db.type/ref one-to-many: :db/cardinality :db.cardinality/many That leaves me the question: how to define an index on an attribute and what about components?

Niki19:07:40

:db/isComponent true

Niki19:07:47

:db/index true

Niki19:07:57

you need index only if you do attribute-value lookups. E.g. (d/datoms db :avet :name "Oleg") will return all entities with :name == "Oleg"

Niki19:07:06

it might happen inside queries too!

Niki19:07:34

if you don’t have indexes, sequential scan will be performed

Niki19:07:52

components, well, are hard to explain :) Read datomic docs