Blob Storage

Store large binary files like images and videos directly in SoliDB with automatic chunking, metadata management, and high-availability replication.

Overview

SoliDB Blob Collections provide a native way to store binary large objects (BLOBs). Unlike standard collections which store JSON documents, blob collections are optimized for immutable binary data.

Chunking

Files are automatically split into manageable chunks for efficient storage and streaming.

Replication

Chunks are consistently hashed and replicated across the cluster for fault tolerance.

Metadata

Automatic JSON metadata document generation for querying and management.

Creating a Blob Collection

Create a collection with type: "blob".

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": "images", "type": "blob", "replicationFactor": 3 }'

Uploading Files

Use multipart/form-data to upload files. The field name for the file content must be file.

POST /_api/blob/:db/:collection
curl -X POST http://localhost:6745/_api/blob/_system/images \
-H "Authorization: Bearer $TOKEN" \

Response

{
  "_key": "018e2345-6789-7abc-def0-1234567890ab",
  "name": "my-photo.jpg",
  "type": "image/jpeg",
  "size": 1048576,
  "chunks": 4,
  "created": "2024-03-15T10:00:00Z"
}

Downloading Files

GET /_api/blob/:db/:collection/:key
# Download file with original name
curl -O -J http://localhost:6745/_api/blob/_system/images/<key> \
-H "Authorization: Bearer $TOKEN"

Metadata & Querying

Because metadata is stored as standard JSON documents, you can filter and query your blobs using SDBQL.

SDBQL Query
FOR doc IN images
  FILTER doc.type == "image/jpeg"
  FILTER doc.size > 5000000
  RETURN doc

Important Note

Deleting the metadata document does NOT automatically delete the binary chunks. Use the DELETE /_api/blob endpoint (coming soon) for full cleanup.