hi, I would like to know if this behavior is expected:
(ds/conn-from-datoms [#datascript/Datom [1 :maker/name "BMW" 536870913 true]
#datascript/Datom [1 :maker/name "BMW" 536870914 false]])
#datascript/DB{:datoms [[1 :maker/name BMW 536870913] [1 :maker/name BMW 536870914]]}
i got into this scenario because I was loading the datoms from a persistent data structure. When I perform the same set of operations in memory, the database has no datoms for these fact
I think I will have to handle this situations when loading the datoms from past databases
https://github.com/metasoarous/datsync was an effort in this direction, but isn't yet batteries included for anything other than full db replication.
Hi @cjsauer. Thanks, will give it a try
Not that I know of…could you give an example of what you’re after?
(def schema
{:thing/parent {:db/unique :db.unique/identity}
:thing/child {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db/isComponent true}})
The key part is the :db/isComponent true
Will usually improve your experience with parent/child stuff
Yes, it could help but in my case from domain modeling perspective the child entity it's not the component of the parent entity
@iagwanderson what is the schema? that dictates which datoms are going to be built and how
Right. :db/isComponent
will cause the child to be retracted along with the parent, which from your problem description is not what you want.
To answer your specific question, to delete a reference from :thing/parent
to :thing/child
you can simply assert
(d/trasnsact conn
[[:db/retract [:thing/parent parent-id] :thing/children [:thing/child child-id]])
Not sure if that helps