Datomic - automatically retract missing component entities -


i have nested structure (that can nested). nested entities marked components. creation works fine.

{:db/id (d/tempid :db.part/user)  :tree/name "some tree"  :tree/nodes [{:node/name "node1"                :node/prop "some prop"}               {:node/name "node2"                :node/prop "another prop"}]} 

let's tree above created. pull update , looks this:

{:db/id 1  :tree/name "some tree"  :tree/nodes [{:db/id 2                :node/name "node1"                :node/prop "some prop"}               {:db/id 3                :node/name "node2"                :node/prop "another prop"}]} 

from ui remove first node:

{:db/id 1  :tree/name "some tree"  :tree/nodes [{:db/id 3                :node/name "node2"                :node/prop "another prop"}]} 

how automatically remove node db/id 2? thing can think of pulling nodes , comparing them nodes i'm submitting. because structure can nested more need traverse collection recursively. there more automatic way this?

the built-in transaction function retractentity recursively retract component entities:

http://docs.datomic.com/transactions.html#dbfn-retractentity


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -