-
-
Notifications
You must be signed in to change notification settings - Fork 9
Time‐Travel & Recovery
Lukatrum edited this page May 12, 2026
·
1 revision
Accidentally deleted a record? Overwrote important data? omni-json-db tracks internal states, allowing you to seamlessly recover data with a single line of code.
jdb["config"] = "Version 1"
jdb["config"] = "Version 2" # Accidentally modified
# Revert to the previous state
jdb.revert("config") # equivalent to jdb.unmodify("config")
assert jdb["config"] == "Version 1"jdb["important_data"] = "Secret"
del jdb["important_data"]
# Bring the deleted data back
jdb.revert("important_data") # equivalent to jdb.unremove("important_data")
assert jdb["important_data"] == "Secret"You can back up and restore the entire database efficiently:
# Backup the current state to a folder named 'bak'
jdb_bak = jdb.backup('bak')
# Restore the database from the backup folder
jdb.restore('bak')