Skip to content

PoloDB/PoloDB

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
March 30, 2023 21:09
November 4, 2021 21:08
October 30, 2021 10:23
February 19, 2021 21:40
January 11, 2023 16:00
src
March 30, 2023 20:58
November 3, 2021 10:44
March 2, 2023 20:48
March 6, 2023 00:09
March 6, 2023 00:09

Crates.io docs.rs License

PoloDB is an embedded JSON-based database.

| Documentations | 中文版 |

Introduction

PoloDB is a library written in Rust that implements a lightweight MongoDB.

PoloDB has no dependency(except for libc), so it can be easily run on most platforms (thanks for Rust Language).

The data of PoloDB is stored in a file. The file format is stable, cross-platform, and backwards compatible.

The API of PoloDB is very similar to MongoDB. It's very easy to learn and use.

Features

  • Simple and Lightweight
    • Only cost ~500kb memory to serve a database
    • The database server binary is less than 2Mb
  • Easy to learn and use
    • NoSQL
    • MongoDB-like API
  • Various language bindings
  • Embedded
    • No standalone processes
    • No cross-process calls
    • No runtime dependency
  • Cross-Platform
  • Multiple backends
    • Filesystem(WAL)
    • Memory

Quick start

PoloDB is easy to learn and use:

use polodb_core::Database;
use serde::{Serialize, Deserialize};

#[derive(Debug, Serialize, Deserialize)]
struct Book {
    title: String,
    author: String,
}

let mut db = Database::open_file(db_path)?;
let mut collection = db.collection::<Book>("books");
collection.insert_one(Book {
    title: "The Three-Body Problem".to_string(),
    author: "Liu Cixin".to_string(),
})?;

Backends

Filesystem Backend

With the filesystem backend, PoloDB stores data in ONE file. All the data are saved persistently on the disk.

It's designed to be flexible, universal, and easy to be searched. All the data are encoded in bson format and stored in the PoloDB's btree format.

PoloDB uses WAL(write-ahead logging) to implement transactional writing and protect your data from program crashes.

Memory Backend

With the memory backend, all the data all stored in memory, making PoloDB a pure memory database.

Platform

Theoretically, PoloDB supports all platforms that the Rust compiler supports. But PoloDB is a personal project currently. Limited by my time, I have only compiled and tested on the following platforms:

  • macOS Big Sur x64
  • Linux x64 (Tested on Fedora 32)
  • Windows 10 x64

Manual

Roadmap

The features will be implemented one by one in order.

  • Basic database API
    • CRUD
    • Transactions
    • Serde
    • Indexes
    • Aggregation
  • Command line Tools
  • Language bindings
  • Multi-threads support
  • Extension API
    • Data Encryption
    • JavaScript Engine
  • Visualization Tools