xtdb 2025-01-14

How can I ensure that the data I pulled hasn’t changed when I compute new information and save it back?

even more specifically, if you're only transacting 'current' data, you can quite simply validate that the _system_from is what you expect and that the _system_to of the record you're trying to change is still NULL/`nil` (otherwise your ASSERT needs to repeat the data itself or rely on some other versioning pattern)

Here we go this is an example of bitemporality used out of the box 😆 But I'm not sure I understand how this works; when you pull data to your app, you also grab some system time that you compare back when you transact some new data to make sure it's the same?

🙂 1

Yep, essentially it's the same pattern as a 'CAS', but you can avoid re-sending the whole original value

Transactions with asserts

✅ 1