whatisgithub

What is bson-rs?

lrlna/bson-rs — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2020-02-27

1RustAudience · developerComplexity · 2/5DormantSetup · easy

In one sentence

A Rust library that converts Rust data structures to and from BSON, the binary format MongoDB uses to store data.

Mindmap

mindmap
  root((bson-rs))
    What it does
      Encode Rust to BSON
      Decode BSON to Rust
      Works with MongoDB
    Tech stack
      Rust
      Serde
    Use cases
      Store structs in MongoDB
      Talk to BSON systems
      Build backend APIs
    Audience
      Rust developers
      Backend engineers
    Quirks
      No unsigned integers
      Compat module for legacy code

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Serialize a Rust struct into BSON before inserting it into a MongoDB collection.

USE CASE 2

Deserialize BSON documents retrieved from MongoDB back into typed Rust structs.

USE CASE 3

Build backend services or APIs that store and retrieve structured data in MongoDB.

USE CASE 4

Communicate with other systems that natively use the BSON format.

What is it built with?

RustSerdeBSONMongoDB

How does it compare?

lrlna/bson-rsabc3dz/mixxxabyo-software/ferro-stash
Stars111
LanguageRustRustRust
Last pushed2020-02-27
MaintenanceDormant
Setup difficultyeasymoderatemoderate
Complexity2/52/54/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires a running MongoDB instance to actually store/retrieve documents.

Copy-paste prompts

Prompt 1
Show me how to use bson-rs to serialize a Rust struct with Serde annotations into BSON.
Prompt 2
Write a Rust function using bson-rs's bson::to_bson() and bson::from_bson() to save and load a struct from MongoDB.
Prompt 3
Explain why bson-rs rejects unsigned integers and how to use its compatibility module for legacy behavior.
Prompt 4
Help me define a Person struct in Rust that can be converted to BSON and inserted into a MongoDB collection.

Frequently asked questions

What is bson-rs?

A Rust library that converts Rust data structures to and from BSON, the binary format MongoDB uses to store data.

What language is bson-rs written in?

Mainly Rust. The stack also includes Rust, Serde, BSON.

Is bson-rs actively maintained?

Dormant — no commits in 2+ years (last push 2020-02-27).

How hard is bson-rs to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is bson-rs for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.