I see that Javers mongo repository stores data in two different collections. Assuming that I am using Javers for auditing, and I am writing my domain objects to another collection, I wonder how atomicity is maintained across these persistence operations. Does Javers perform some kind of two-phase commits to maintain sanity between it's two internal collections? Does it provide hooks for the client application's persistence operations to be in sync with the audit logs?
In MongoDB there are no transactions. All you have is atomic write on Document level (see https://docs.mongodb.com/manual/core/write-operations-atomicity/). JaVers doesn't implement any kind of "multi-document transactions" on the application side.
If you need SQL-like transactions, choose JaversSqlRepository with JPA EntityManager integration (see https://javers.org/documentation/spring-integration/#jpa-entity-manager-integration).