Documents Storage

SoliDB's core storage engine. High-performance, transactional Key-Value storage for JSON documents.

Overview

Document collections are the default storage type in SoliDB. They provide flexible, schema-free storage for JSON documents while maintaining full ACID guarantees.

Fast Key-Value

Optimized for point lookups and range scans using primary keys.

JSON Native

Store arbitrary JSON structures. No rigid schemas required.

Transactional

Multi-document, multi-collection ACID transactions supported out of the box.

Creating a Document Collection

Create a collection with type: "document" (default).

POST /_api/database/:db/collection
curl -X POST http://localhost:6745/_api/database/_system/collection \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "users", "type": "document" }'

JSON Schema Validation

Enforce data integrity by attaching a JSON Schema to your collection. SoliDB supports three validation modes:

Strict
Rejects any document that violates the schema.
Lenient
Accepts invalid documents but logs a warning.
Off
Disables validation (default).

Create with Schema

POST /_api/database/:db/collection
curl -X POST http://localhost:6745/_api/database/_system/collection \
-H "Authorization: Bearer $TOKEN" \
-d '{ "name": "products", "schema": { "type": "object", "required": ["name", "price"], "properties": { "name": { "type": "string" }, "price": { "type": "number", "minimum": 0 } } }, "validationLevel": "strict" }'

Validation Error

Attempting to insert an invalid document in strict mode will return a 400 Bad Request error with details about the schema violation.

Basic Operations

Insert Document

POST /_api/document/:db/:collection
curl -X POST http://localhost:6745/_api/document/_system/users \
-d '{ "name": "Alice", "email": "[email protected]" }'

Read Document

GET /_api/document/:db/:collection/:key
curl http://localhost:6745/_api/document/_system/users/123