diff --git a/README.md b/README.md index 4af541b..aceb7dd 100644 --- a/README.md +++ b/README.md @@ -294,10 +294,10 @@ futriix:~> drop database test ```sh # Создание новой базы данных futriix:~> create database company -✓ Database 'company' created +✓ Database 'company' created at 2026-01-15 10:30:45.123 futriix:~> create database shop -✓ Database 'shop' created +✓ Database 'shop' created at 2026-01-15 10:30:46.456 # Переключение на базу данных futriix:~> use company @@ -309,53 +309,51 @@ futriix:~> use shop # Просмотр всех баз данных futriix:~> show databases Databases: - company - * shop - test + company (created: 2026-01-15 10:30:45.123) + * shop (created: 2026-01-15 10:30:46.456) + test (created: 2026-01-14 09:15:22.789) # Удаление базы данных futriix:~> drop database test -✓ Database 'test' dropped -``` -```sh +✓ Database 'test' dropped at 2026-01-15 10:31:12.789 + + # Создание коллекции futriix:~> use company ✓ Switched to database 'company' futriix:~> create collection employees -✓ Collection 'employees' created in database 'company' +✓ Collection 'employees' created in database 'company' at 2026-01-15 10:32:15.234 futriix:~> create collection departments -✓ Collection 'departments' created in database 'company' +✓ Collection 'departments' created in database 'company' at 2026-01-15 10:32:18.567 futriix:~> create collection projects -✓ Collection 'projects' created in database 'company' +✓ Collection 'projects' created in database 'company' at 2026-01-15 10:32:21.890 # Просмотр всех коллекций futriix:~> show collections Collections in database 'company': - - employees - - departments - - projects + - employees (created: 2026-01-15 10:32:15.234) + - departments (created: 2026-01-15 10:32:18.567) + - projects (created: 2026-01-15 10:32:21.890) # Удаление коллекции futriix:~> drop collection projects -✓ Collection 'projects' dropped from database 'company' +✓ Collection 'projects' dropped from database 'company' at 2026-01-15 10:33:05.123 -``` -```sh # Вставка документа (простой формат key=value) futriix:~> insert employees name=John Doe,position=Developer,age=30,department=IT -✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440000 +✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440000 (created at: 2026-01-15 10:34:22.345) futriix:~> insert employees name=Jane Smith,position=Manager,age=35,department=HR -✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440001 +✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440001 (created at: 2026-01-15 10:34:25.678) futriix:~> insert employees name=Bob Johnson,position=Designer,age=28,department=Design -✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440002 +✓ Document inserted with ID: 550e8400-e29b-41d4-a716-446655440002 (created at: 2026-01-15 10:34:28.901) -# Поиск документа по ID +# Поиск документа по ID (с отображением временных меток) futriix:~> find employees 550e8400-e29b-41d4-a716-446655440000 Document found: { @@ -364,11 +362,13 @@ Document found: "age": 30, "department": "IT" } + created_at: 2026-01-15 10:34:22.345 + updated_at: 2026-01-15 10:34:22.345 # Поиск по индексу futriix:~> findbyindex employees name_idx "John Doe" Found 1 document(s): - [1] ID: 550e8400-e29b-41d4-a716-446655440000 + [1] ID: 550e8400-e29b-41d4-a716-446655440000 (updated: 2026-01-15 10:34:22.345) { "name": "John Doe", "position": "Developer", @@ -376,21 +376,111 @@ Found 1 document(s): "department": "IT" } -# Обновление документа +# Обновление документа (временная метка обновляется автоматически) futriix:~> update employees 550e8400-e29b-41d4-a716-446655440000 age=31,position=Senior Developer -✓ Document '550e8400-e29b-41d4-a716-446655440000' updated +✓ Document '550e8400-e29b-41d4-a716-446655440000' updated at 2026-01-15 10:35:45.234 -# Подсчёт количества документов +# Повторный поиск после обновления (показывает обновлённую временную метку) +futriix:~> find employees 550e8400-e29b-41d4-a716-446655440000 +Document found: +{ + "name": "John Doe", + "position": "Senior Developer", + "age": 31, + "department": "IT" +} + created_at: 2026-01-15 10:34:22.345 + updated_at: 2026-01-15 10:35:45.234 ← обновилась! + +# Подсчёт количества документов (с детальной статистикой) futriix:~> count employees -Collection 'employees' has 3 document(s) +=== Collection 'employees' statistics === + Active documents: 2 + Deleted documents: 1 + Total documents: 3 -# Удаление документа +# Удаление документа (мягкое удаление с временной меткой) futriix:~> delete employees 550e8400-e29b-41d4-a716-446655440002 -✓ Document '550e8400-e29b-41d4-a716-446655440002' deleted +✓ Document '550e8400-e29b-41d4-a716-446655440002' deleted at 2026-01-15 10:36:15.678 futriix:~> count employees -Collection 'employees' has 2 document(s) +=== Collection 'employees' statistics === + Active documents: 2 + Deleted documents: 1 + Total documents: 3 +# Просмотр временных меток конкретного документа +futriix:~> show timestamps employees 550e8400-e29b-41d4-a716-446655440000 +=== Timestamps for document: 550e8400-e29b-41d4-a716-446655440000 === + Created: 2026-01-15 10:34:22.345 (1735127662345) + Updated: 2026-01-15 10:35:45.234 (1735127745234) + Deleted: not deleted + Version: 2 + +# Просмотр мягко удалённых документов +futriix:~> show deleted employees +=== Deleted documents in collection 'employees' === + [1] ID: 550e8400-e29b-41d4-a716-446655440002 (deleted: 2026-01-15 10:36:15.678) + +# Восстановление мягко удалённого документа +futriix:~> restore employees 550e8400-e29b-41d4-a716-446655440002 +✓ Document '550e8400-e29b-41d4-a716-446655440002' restored at 2026-01-15 10:37:05.123 + +futriix:~> count employees +=== Collection 'employees' statistics === + Active documents: 3 + Deleted documents: 0 + Total documents: 3 + +# Статистика временных меток коллекции +futriix:~> stats timestamps employees +=== Timestamp statistics for collection 'employees' === + Documents count: 3 + + Created timestamps: + Earliest: 2026-01-15 10:34:22.345 + Latest: 2026-01-15 10:34:28.901 + Average: 2026-01-15 10:34:25.456 + + Updated timestamps: + Earliest: 2026-01-15 10:34:22.345 + Latest: 2026-01-15 10:37:05.123 + Average: 2026-01-15 10:35:44.234 + +# Поиск документов по временному диапазону +futriix:~> findbytime employees 2026-01-15 10:34:00 2026-01-15 10:35:00 +=== Documents created between 2026-01-15 10:34:00 and 2026-01-15 10:35:00 === + [1] ID: 550e8400-e29b-41d4-a716-446655440000 (created: 2026-01-15 10:34:22.345) + [2] ID: 550e8400-e29b-41d4-a716-446655440001 (created: 2026-01-15 10:34:25.678) + [3] ID: 550e8400-e29b-41d4-a716-446655440002 (created: 2026-01-15 10:34:28.901) + +# Создание индекса (с временной меткой) +futriix:~> create index employees name_idx name +✓ Index 'name_idx' created on collection 'employees' at 2026-01-15 10:38:15.456 + +# Просмотр индексов (с временем создания) +futriix:~> show indexes employees +Indexes on collection 'employees': + - _id_: [_id] (created: 2026-01-15 10:32:15.234) + - name_idx: [name] (created: 2026-01-15 10:38:15.456) + +# Просмотр лога аудита (все операции с временными метками) +futriix:~> audit log +=== Audit Log (last 50 entries) === + [2026-01-15 10:38:15.456] CREATE_INDEX - COLLECTION: company.employees + [2026-01-15 10:37:05.123] RESTORE - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440002 + [2026-01-15 10:36:15.678] SOFT_DELETE - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440002 + [2026-01-15 10:35:45.234] UPDATE - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440000 + [2026-01-15 10:34:28.901] INSERT - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440002 + [2026-01-15 10:34:25.678] INSERT - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440001 + [2026-01-15 10:34:22.345] INSERT - DOCUMENT: company.employees.550e8400-e29b-41d4-a716-446655440000 + [2026-01-15 10:33:05.123] DROP - COLLECTION: company.projects + [2026-01-15 10:32:21.890] CREATE - COLLECTION: company.projects + [2026-01-15 10:32:18.567] CREATE - COLLECTION: company.departments + [2026-01-15 10:32:15.234] CREATE - COLLECTION: company.employees + [2026-01-15 10:31:12.789] DROP - DATABASE: test + [2026-01-15 10:30:46.456] CREATE - DATABASE: shop + [2026-01-15 10:30:45.123] CREATE - DATABASE: company ```
(К началу)