A common web site use case is notifying a user of a change of address, with notifications to both old and new addresses.
This is a simple mechanism that helps to address fraud.
Generally this code would form part of the http post action, perhaps including some indirection via a queue.
Arguably that logic is orthogonal to the primary function of the web site.
Datomic records all changes to entities and provides a notification mechanism
The following gist illustrates how this might be implemented.
Line 39 creates a user with the name "john" and email "email@example.com".
Line 44 updates that user, changing the email to "firstname.lastname@example.org"
Line 46 defines a query that will retrieve the name and previous email, given a delta to the user entity
Line 59 will print empty result since qe is the change that created the user (and there is thus no previous value)
Line 62 creates the result:("john", "email@example.com","firstname.lastname@example.org")
Which provides the name, before and after emails needed to send the warning email.