The Principal Dev – Masterclass for Tech Leads

The Principal Dev – Masterclass for Tech Leads28-29 May

Join

PoloDB

An embedded document database for Rust with a MongoDB-like API.

CI Crates.io docs.rs GitHub release Apache-2.0 license

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

Project status

The latest stable release is v5.3.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.3.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.3.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.

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.