49 lines
1.5 KiB
Markdown
49 lines
1.5 KiB
Markdown
---
|
|
obj: application
|
|
website: https://surrealdb.com
|
|
repo: https://github.com/surrealdb/surrealdb
|
|
---
|
|
|
|
# SurrealDB
|
|
SurrealDB is a powerful, cloud-native, multi-model database built for modern application development. It supports relational, document, graph, vector, and real-time data access, all via a unified SQL-like query language called SurrealQL. There is also a GUI called Surrealist.
|
|
|
|
## Multi-Model Support
|
|
- **Relational**: Traditional table structure with foreign key-like linking.
|
|
- **Document**: JSON-based records with schema-less flexibility.
|
|
- **Graph**: Native support for linked data using edges and nodes.
|
|
- **Vector**: Built-in similarity search for AI/ML use cases.
|
|
- **Real-time**: Subscriptions and change feeds.
|
|
- **Time-Series & Search**: Native support for time-ordered and full-text queries.
|
|
|
|
## SurrealQL
|
|
SurrealQL blends the familiarity of SQL with document/graph features.
|
|
|
|
```sql
|
|
-- Create a user
|
|
CREATE user:john SET name = 'John Doe', email = 'john@example.com';
|
|
|
|
-- Read a record
|
|
SELECT * FROM user:john;
|
|
|
|
-- Create a relationship (graph)
|
|
RELATE user:john->friend->user:jane;
|
|
|
|
-- Search by text
|
|
SELECT * FROM article WHERE content CONTAINS 'database';
|
|
|
|
-- Vector similarity search
|
|
SELECT * FROM embeddings WHERE vector <-> [0.1, 0.2, 0.3] LIMIT 3;
|
|
```
|
|
|
|
## Compose
|
|
|
|
```yml
|
|
services:
|
|
surrealdb:
|
|
ports:
|
|
- 80:8000
|
|
volumes:
|
|
- /local-dir:/container-dir
|
|
image: surrealdb/surrealdb:latest
|
|
command: start --user root --pass root rocksdb:/container-dir/mydatabase.db
|
|
```
|