Menu
#ferrite_db
ferrite_db is a document database server written in Rust. It is a standalone service that clients connect to over TCP, in the style of MongoDB: databases hold collections, collections hold documents with nested values, and you query them with filters, update operators and aggregation pipelines.
It is a one-person project, built as a way to learn Rust. It is a work in progress, and it is MIT licensed.
#What it is
- A TCP server. Each request and each reply is one line of JSON, or a binary message if the client asks for that.
ncis enough to talk to it. - Documents with null, bool, int, float, string, array, document, date and ObjectId values.
- MongoDB-style filters, update operators and aggregation, with the same names where it has them.
- Indexes on one field or several, unique indexes, and sorts served from an index.
- Multi-document transactions on one database, and change streams.
- Users and roles with SCRAM-SHA-256, a shared token, TLS 1.3, and a read-only follower that copies a leader.
- An append-only binary log with a checksum on every record, replayed on startup. The whole database is kept in RAM.
#What it is not
- It is not MongoDB, and it does not speak MongoDB's wire protocol. Existing MongoDB drivers do not work with it.
- It is not clustered or sharded. There is one server that takes writes. A follower can copy it for reads, and there is no failover.
- It is not a database for data bigger than memory, because everything lives in RAM.
- It is not battle tested. It has been tried by one person.
Differences in behaviour from MongoDB are noted on the reference pages where they matter. The limits that apply to every request, such as message sizes and the memory limit, are on Memory and limits.
#Where to go
| Section | What is in it |
|---|---|
| Installation | Building from source, the crate, the .deb |
| Quick start | A first session with nc |
| Configuration | Every environment variable and argument |
| Requests and replies | The shape of a request, replies, databases, ids and dates |
| Filters | Query operators, paths, arrays, sort, skip, limit, projection |
| Updates and writes | Update operators, upserts, findOneAndUpdate, replace, delete, distinct |
| Aggregation | Every pipeline stage and expression |
| Indexes | Equality, range, compound and unique indexes |
| Transactions | begin, commit, abort and what can go wrong |
| Change streams | watch |
| Collections and databases | Listing, dropping and compacting |
| Errors | The error codes |
| Deployment | Running it as a service |
| Authentication, TLS, Replication | Operating a server that other machines use |
| Writing a client | Talking to the server from your own code |