16 Older versions of a node
Every write appends the whole node to the transaction log, linked to the version before it. So the
log is a version history, and FindOlderVersions reads it, newest first:
NodeVersion<IVenue>[] history = db.FindOlderVersions<IVenue>(venueId); // up to 100
NodeVersion<IVenue>[] recent = db.FindOlderVersions<IVenue>(venueId, maxCount: 10);
foreach (var v in history) {
Console.WriteLine($"{v.EstimatedCreationUtc:u} {v.Node.Name} capacity {v.Node.Capacity}");
}Each NodeVersion<T> holds the node as it was (Node) and the time of the write (Timestamp, or
EstimatedCreationUtc as a UTC time). The current version is not included.
- It reads the log files on every call. Use it for history and audit screens, not on every page view.
- How far back it reaches depends on the log. A log rewrite (a backup with
TruncateBackups, orAutoTruncate) keeps only the current state. Turn onSecondaryBackupLog(§12.1) to keep a second log that survives rewrites. - Relations are not versioned. The relation properties of a version read the store as it is now.
- Deleted nodes have no history, and inserting the same id again starts a new one.
- 16.1 Reverting the database to an earlier point — The revert API puts the whole database back to an earlier point by permanently deleting every transaction after it. Use it for experiments, tests and seeding, by hand or from a coding agent: try something on real data…