Fork me on GitHub
#datomic
<
2022-03-21
>
Shuky Badeer17:03:29

Heyy guys! general question, suppose we have a movie "row" in datomic, we change it's name at some point, then we query that movie to get its details, does datomic return the latest version of it or ALL versions? Can we tell datalog whether to send all versions or not? Thanks a lot!

camdez19:03:28

Most commonly you’ll be working with the latest version of an entity. If you specify an older state of the database (often done via a timestamp), then you can see the entity as it was. Alternately you can query the history of changes to attributes and assemble your own notion of the versions.

Shuky Badeer09:03:13

@U0CV48L87 thank you! So, by default, a query in datomic returns the latest version of the datom? Right now i seem to be getting all versions of it so i wonder if i'm doing something wrong in adding datoms or whether i should adjust the query code

Jarrod Taylor (Clojure team)14:03:50

If you want to provide a link to example code demonstrating your efforts we can help you understand the responses you are seeing.

jaret15:03:16

Yeah, I think it's easiest to look at an example @U033V0AJFU4 so feel free to share. But in Datomic you pass a DB value to the query. You will get results in query from the DB value you are passing, in Datomic a https://docs.datomic.com/cloud/whatis/data-model.html#database is a set of datoms. A point-in-time immutable value that will never change. If you want to see all history we have the https://docs.datomic.com/client-api/datomic.client.api.html#var-historyhttps://docs.datomic.com/on-prem/clojure/index.html#datomic.api/history(see also: https://docs.datomic.com/cloud/tutorial/history.html#history-query). This is true for both on-prem and Cloud.