Fork me on GitHub
#datomic
<
2017-03-12
>
nathansmutz00:03:37

@yonatanel I might look into that more. My larger project involves returning a set satisfying lots of aggregate predicates (is that a good term?) like that. I'm generating (or proving the non-feasibility of) education plans for finishing a Bachelor's degree within 4 years. There are requirements like "no more than 15 credits per academic term/semester" and "must contain at least 6 credits worth of this subset of courses"

Ethan Miller13:03:13

Does anyone know if there’s a tutorial out there that explains how to update nested entities, ie. entities that are components? Or explain here?

Ethan Miller13:03:06

Let’s say I have nested structure like this:

[:x/value [{:x/value [{:text “test”}]}]]
where :x/value is defined in the schema as a component. When transacted, I get the entity id for this entity 12345. Later, I want to update the nested value. How would I do that?

favila19:03:17

Get the db/id of the component entity, and add/retract on that entity like any other @ezmiller77

Ethan Miller19:03:48

@favila i think add is the piece i’ve been missing. since I’ve just been using (d/transact) so far.

favila19:03:28

@ezmiller77 no this is not a function. Db/add, db/retract assertions etc

favila19:03:06

Or a map with db/id on it or some unique attr value

favila19:03:09

@ezmiller77 component entities are not special, it's the component attribute that is special

Ethan Miller19:03:37

@favila I think I follow.

Ethan Miller19:03:04

I think I have two separate problems that I’ve been treating as one. The first is just how to do that update, which I think you answered. The second is more related to my particular problem: that if the value of :text has changed than I won’t know which entity to update unless I keep track of the :db/id.