@favila Thanks for the tip!
Hi š
In Datomic Cloud, what is the recommended way of getting a sorted result set from a query?
Two variations on the theme that Iām interested in would be sorted by transaction :db/txInstant
or sorted by arbitrary attribute on the entity.
index-pull if there is one :avet or cardinality-many :aevt index that matches your results and desired order
otherwise, just sort in the application
I see, thanks!
I just want to double check, beyond :db/cas
and transaction functions, which must be installed, there's no way to ensure a state before transacting, no?
@uwo What kind of guarantees are you looking for?
I want to ensure that no other transactions have touched the target datoms entity before committing the transaction. I would use cas, however I need to read one attribute and then set another, sadly.
this is an ad hoc thing, otherwise we would just install a transaction function that could throw if the constraints weren't matched
I'm not sure why cas doesn't support what you want.
{:tx-data [[:db/cas 42 :no/touchy 100 100] [:db/add 9000 :iff/no-touchy-cas "winning?"]]}
AH HA! I just leave the cas'd value the same -- I didn't realize that a single cas would cancel the entire transaction. That's great!!
Yay ACID š
Right of course. Man I ask really embarrassing questions. thanks for entertaining them
Haha, no way @uwo I love your questions!!
Thanks Joe!