Fork me on GitHub
#keechma
<
2017-04-23
>
urbank09:04:14

What kind of thing do you think should be in entitydb item meta-data? I know one example is a loading marker. So I suppose things that you wouldn't persist to the server?

mihaelkonjevic10:04:47

@urbank yeah, I’m using meta to keep the information about the collection or named item, params that you used to load the collection, current status and stuff like that

urbank13:04:38

With entity db, if I want to apply some function to each entity in a collection, should I reinsert the modified collection, or go by id and update the items?

urbank13:04:22

Because with reinsertion, I think there's a problem with the thing that's there because of cyclical relations

urbank13:04:02

If I do (insert-collection (f (get-collection))) and the entities in collection have a field that's a relation (therefore a function), I think there's an error

urbank13:04:00

basically, there's an error if in (insert-collection entities), some fields of the entities are functions

urbank13:04:49

hm... wait

urbank13:04:58

So the error occurs when inserting an entity with a field that's marked as a relation in the schema, and that field is a function

urbank13:04:47

Of course it's possible to call all the :author functions before reinserting, but that doesn't help if the relations are cyclical.

mihaelkonjevic16:04:52

@urbank, yes that issue exists (when inserting the item that has assoctiations)

mihaelkonjevic16:04:49

You can either remove the values that are functions from the entity map

mihaelkonjevic16:04:48

or you can update with only the changed attrs - they will be merged by entitydb

mihaelkonjevic16:04:06

so if you have entity that looks like this {:id 1, :name "foo"} in the entitydb and you insert {:id 1, :lastname "bar"} you will get the entity that looks like {:id 1 :name "foo" :lastname "bar"} as a result

urbank16:04:07

Ah, that makes sense, thanks