Skip to content

mojo-bson

mojo-bson is a BSON serializer written in Mojo. The runtime and the code generator are Mojo. They do not wrap libbson or any other C, C++, or Rust BSON library.

  • Why BSON


    What a BSON document is, how type bytes and length prefixes work, and how Extended JSON relates to the binary form.

    Read Why BSON

  • Instructions


    Install Mojo 1.1.0 with pixi, write a JSON Schema, generate Mojo, run the tests, and publish this site.

    Open Instructions

  • Examples


    Encode and decode a generated struct, a dynamic document, and canonical Extended JSON.

    See Examples

  • Techniques


    How encode and decode work: exact buffers, length patching, cstring scans, and which ideas were kept or dropped.

    Read Techniques

  • Test data


    What lives under testdata/ (schemas and the pymongo oracle) and why each file is there.

    Read Test data