# Connect to ChronDB
redis-cli -h localhost -p 6379
# Set document
SET user:1 '{"name":"John Doe","email":"[email protected]"}'
# Get document
GET user:1
# Get history
CHRONDB.HISTORY user:1
-- View all versions of a user document
SELECT * FROM chrondb_history('user', '1');
-- Get only the commit IDs and timestamps
SELECT commit_id, timestamp FROM chrondb_history('user', '1');
-- View user document as it was at commit 'abc123def456'
SELECT * FROM chrondb_at('user', '1', 'abc123def456');
-- Extract just the name field from a historical version
SELECT name FROM chrondb_at('user', '1', 'abc123def456');
-- Compare user document between two versions
SELECT * FROM chrondb_diff('user', '1', 'abc123def456', 'def456abc123');
-- View only the changes between versions
SELECT changed FROM chrondb_diff('user', '1', 'abc123def456', 'def456abc123');
# Connect to ChronDB
psql -h localhost -p 5432 -U chrondb
# Create document
INSERT INTO user (id, name, email) VALUES ('1', 'John Doe', '[email protected]');
# Query document
SELECT * FROM user WHERE id = '1';
# Update document
UPDATE user SET email = '[email protected]' WHERE id = '1';
# Get history
SELECT * FROM chrondb_history('user', '1');