elixir-cbson

Hex.pm Version

BSON NIF for Elixir language http://bsonspec.org

THANKS

This library has taken many great ideas and codes from Jiffy to make it fasting and flexible.

The API of elixir-cbson is the same as elixir-bson which I always used in my projects.

WARNING

MongoDB Driver

The MongodB driver using this project is here, being changed from elixir-mongo.

Usage

CBson.decode/1,2

The options for decode are:

CBson.encode/1,2

The options for encode are:

Types

BSON Type Elixir Type Notes
ObjectId %Bson.ObjectId{}
double double
string string
doc map or keywords :return_lists
array list
binary %Bson.Bin{}
bool atom: true/false
datetime %Bson.UTC{}
Null nil :use_null/:nil_term
Regex %Bson.Regex{}
JavaScript not supported
int32 integer
Timestamp %Bson.Timestamp{}
int64 integer
Min key atom: min_key
Max key atom: max_key

Benchmarking

There're some benchmark cases vs mongodb & elixir-bson

MIX_ENV=bench mix bench