<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Datomic Knowledgebase - Recent questions tagged :db ensure</title>
<link>https://ask.datomic.com/index.php/tag/%3Adb%20ensure</link>
<description>Powered by Question2Answer</description>
<item>
<title>Why does :db/ensure appear as an attribute in my entities?</title>
<link>https://ask.datomic.com/index.php/681/why-does-db-ensure-appear-as-an-attribute-in-my-entities</link>
<description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I wonder if you might be able to help me with something?&lt;/p&gt;
&lt;p&gt;I am trying to use an entity spec with datomic to provide constraint checking when entities are transacted/retracted from the database using &lt;code&gt;:db/ensure&lt;/code&gt;. This works fine - if my predicate fails the entities are not transacted into Datomic. But in the case where the predicate passes the &lt;code&gt;:db/ensure&lt;/code&gt; key/value also appears to be stored in the database - it&#039;s visible when I pull the entity out again. This isn&#039;t what I expected to happen according to the docs:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.datomic.com/cloud/schema/schema-reference.html#entity-specs&quot;&gt;https://docs.datomic.com/cloud/schema/schema-reference.html#entity-specs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&quot;:db/ensure is a virtual attribute. It is not added in the database; instead it triggers checks based on the named entity.&quot;&lt;/p&gt;
&lt;p&gt;Have I done something wrong causing &lt;code&gt;:db/ensure&lt;/code&gt; to be added to the database? Or have I misunderstood the docs?&lt;/p&gt;
&lt;p&gt;I&#039;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: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03RZMDSH/p1635858493193300&quot;&gt;https://clojurians.slack.com/archives/C03RZMDSH/p1635858493193300&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If anyone can point me in the right direction that would be much appreciated, cheers!&lt;/p&gt;
</description>
<category>Cloud</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/681/why-does-db-ensure-appear-as-an-attribute-in-my-entities</guid>
<pubDate>Tue, 09 Nov 2021 16:52:46 +0000</pubDate>
</item>
</channel>
</rss>