Welcome! Please see the About page for a little more info on how this works.

0 votes
in Cloud by

Hi there,

I wonder if you might be able to help me with something?

I am trying to use an entity spec with datomic to provide constraint checking when entities are transacted/retracted from the database using :db/ensure. This works fine - if my predicate fails the entities are not transacted into Datomic. But in the case where the predicate passes the :db/ensure key/value also appears to be stored in the database - it's visible when I pull the entity out again. This isn't what I expected to happen according to the docs:

https://docs.datomic.com/cloud/schema/schema-reference.html#entity-specs

":db/ensure is a virtual attribute. It is not added in the database; instead it triggers checks based on the named entity."

Have I done something wrong causing :db/ensure to be added to the database? Or have I misunderstood the docs?

I've got a simple test case showing this behaviour if it helps see what I mean. You can find that in the Clojurians Slack channel where I originally asked this question: https://clojurians.slack.com/archives/C03RZMDSH/p1635858493193300

If anyone can point me in the right direction that would be much appreciated, cheers!

Please log in or register to answer this question.

...