7 stable releases
| 5.3.0 | Jul 26, 2026 |
|---|---|
| 5.2.0 | Jul 18, 2026 |
| 5.1.4 | May 15, 2025 |
| 5.1.2 | Sep 29, 2024 |
| 5.1.0 | Aug 23, 2024 |
#778 in Database interfaces
1MB
11K
SLoC
An embedded document database for Rust with a MongoDB-like API.
PoloDB stores BSON documents locally and exposes familiar collection, query, update, index, aggregation, and transaction APIs. It can be used as an embedded Rust library or run as a standalone server with partial MongoDB wire protocol compatibility.
Features
- Embedded, typed Rust API built around
serdeand BSON - MongoDB-like CRUD, query, update, index, and aggregation APIs
- Explicit transactions and automatic per-operation transactions
- Concurrent use through clonable database handles
- RocksDB-backed persistent storage
- Standalone server for supported MongoDB driver operations
- Experimental Python bindings built from the same Rust core
Project status
The latest stable release is v5.2.0. See the changelog for release details.
PoloDB v5 uses RocksDB as its storage backend. A database path is a directory, not a single portable database file. The first build compiles the bundled RocksDB sources and can take several minutes.
Rust CI currently covers Ubuntu x64, Ubuntu ARM64, macOS, and Windows. Python bindings are tested on Python 3.12 through 3.14. Indexes, aggregation, the standalone server, and language bindings continue to evolve; test the behavior your application depends on before using PoloDB in production.
Installation
Add the embedded library and Serde to your project:
[dependencies]
polodb_core = "5.2.0"
serde = { version = "1", features = ["derive"] }
Building requires a Rust toolchain, a C/C++ build toolchain, and Clang/libclang for the bundled RocksDB bindings.
Quick start
use polodb_core::{bson::doc, CollectionT, Database};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
struct Book {
title: String,
author: String,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let db = Database::open_path("./data/books")?;
let books = db.collection::<Book>("books");
books.insert_one(Book {
title: "The Three-Body Problem".to_string(),
author: "Liu Cixin".to_string(),
})?;
let book = books.find_one(doc! {
"author": "Liu Cixin",
})?;
println!("{book:?}");
Ok(())
}
See the PoloDB documentation and
polodb_core API documentation for queries,
updates, indexes, aggregation, and transactions.
Standalone server
Install and start the server:
cargo install polodb --version 5.2.0
polodb serve --path ./data/server --host 127.0.0.1 --port 27017
The server implements the subset of the MongoDB wire protocol used by its supported commands. It is not a drop-in replacement for a full MongoDB server.
Packages
| Package | Status | Purpose |
|---|---|---|
polodb_core |
Published | Embedded Rust database library |
polodb |
Published | Standalone server and CLI |
py-polodb |
Experimental | Python bindings developed in this repository |
Release binaries for the standalone server are published for macOS x64, Linux x64, and Windows x64 on the GitHub Releases page.
Roadmap and support
Open work is tracked in GitHub Issues. Mobile SDKs, additional language bindings, encryption, multikey indexes, and alternative storage backends require further design and are not part of the current stable feature set.
License
PoloDB is licensed under the Apache License 2.0.
Dependencies
~39MB
~749K SLoC