This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Hi. I would like to confirm something. If we have unique id e.g. username. Then me make a transaction to store userdetails. When we want to update user details it should be sufficient to make just similar transaction providing same username. Then tempid should be resolved to existing entity id ? And we thus we can change other properties ?
@voytech: In this case, you wouldn't use a temp id, you'd use a lookup ref. There's an example in this blog post: http://blog.datomic.com/2014/02/datomic-lookup-refs.html
@bhagany Thanks for answer. I wil use lookup refs then, But i think documentation says that tempid should be resolved to existing id. It is in section about transactions I think. Or maybe I understand i wrong...
@bhagany At least lookup ref gives You control because by providing lookup ref You are explicitly defining transaction as an update. Hmm but when you are providing transaction with unique property :username which already exists in db - this should be update too - what else could happen ? Knowing that username already has this value we cannot create another entity with this value because it already exists. For me there are two results - failure or successfull update on existing entity :)
@bhagany. My question was added here because after adding entity with the same username again I still have the old entity. This is strange...
@voytech: Hmm, that is odd… does your unique attribute have :db.unique/identity
, or :db.unique/value
?
@voytech: Okay. I found this thread, which seems related, but the bug they were talking about should be fixed: https://groups.google.com/forum/#!topic/datomic/30ADvlLV9f4
@voytech: oh, I understood you to be saying that you ended up with two entities with the same unique attribute
@bhagany no after upsert there is only old entity. I'll double check. Now i don't have access to my env. Maybe I'm doing something stupi somewhere around.