Skip to content

v0.10.0 Entity selection retrieval and manipulation

Choose a tag to compare
@marcgrue marcgrue released this 19 Oct 07:43
· 464 commits to master since this release

Molecule now allows retrieving attribute values of selected entities:

val List(e1, e2, e3) =, 2, 3).eids

// Use selected entity ids to access attributes of those entities
Ns(e1, e2).int.get === List(1, 2)

// Or use a variable with a collection of entity ids
val e23 = Seq(e2, e3)
Ns(e23).int.get === List(2, 3)

Likewise we can update attribute values of selected entities (group editing):

val List(a, b, c) = insert List(("a", 1), ("b", 2), ("c", 3)) eids

// Apply value to attribute of multiple entities
Ns(a, b).int(4).update === List(("a", 4), ("b", 4), ("c", 3))

See more examples here and here.

Datomic encourages multi-step queries where you find some entities ids with one query and then pass those ids on as input to the following query. Since we don't have the cost of round-trips to a database server, this is a powerful technique that Molecule now supports with ease.