# ![Face](logotype/logo_32x32.png) BSON support Implements [BSON specification][spec]. ![T][travis-svg] ![A][appveyor-svg] ![L][license-svg] [travis-svg]: https://travis-ci.com/MARTIMM/BSON.svg?branch=master [travis-run]: https://travis-ci.com/MARTIMM/BSON [appveyor-svg]: https://ci.appveyor.com/api/projects/status/github/MARTIMM/BSON?branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20FAIL&pendingText=Windows%20-%20pending&svg=true [appveyor-run]: https://ci.appveyor.com/project/MARTIMM/BSON/branch/master [license-svg]: https://martimm.github.io/label/License-label.svg [licence-lnk]: https://www.perlfoundation.org/artistic_license_2_0 ## Synopsis The main entry point is B. This structure is a Hash like object but will keep the order of its keys and because of that there is no need for cumbersome operations. At the moment it is much slower than the hashed variant even with the encoding happening in the background and parallel. ``` use BSON::Document; my BSON::Javascript $js .= new(:javascript('function(x){return x;}')); my BSON::Javascript $js-scope .= new( :javascript('function(x){return x;}'), :scope(BSON::Document.new: (nn => 10, a1 => 2)) ); my BSON::Binary $bin .= new(:data(Buf,new(... some binary data ...)); my BSON::Regex $rex .= new( :regex('abc|def'), :options); my BSON::Document $d .= new: ( 'a number' => 10, 'some text' => 'bla die bla'); $d = BSON::ObjectId.new; $d = $js; $d = $js-scope; $d = DateTime.now; $d = $bin; $d = $rex; $d = Any; $d = [ 10, 'abc', 345]; $d = a1 => 10, bb => 11; $d = q => 255; my Buf $enc-doc = $d.encode; my BSON::Document $new-doc .= new; $new-doc.decode($enc-doc); ``` ## Documentation BSON/Document.pod * [ 🔗 Website]() * [ 🔗 Travis-ci run on master branch][travis-run] * [ 🔗 Appveyor run on master branch][appveyor-run] * [ 🔗 License document][licence-lnk] * [ 🔗 Release notes](https://martimm.github.io/raku-mongodb-driver/content-docs/about/release-notes.html) * [ 🔗 Issues](https://github.com/MARTIMM/raku-mongodb-driver/issues) ## Installing BSON Use zef to install the package like so. ``` $ zef install BSON ``` When installing MongoDB, BSON will be installed automatically as a dependency. ## Version of Raku and MoarVM This module is tested using the latest Raku version on MoarVM ## Authors Original creator of the modules is Pawel Pabian (2011-2015, v0.3)(bbkr on github). Current maintainer Marcel Timmerman (2015-present)(MARTIMM on github). ## Contributors Dan Zwell (lefth on github) [spec]: http://bsonspec.org/ [Binary]: https://github.com/MARTIMM/BSON/blob/master/doc/Binary.pdf [Document]: https://github.com/MARTIMM/BSON/blob/master/doc/Document.pdf [notes]: https://github.com/MARTIMM/BSON/blob/master/doc/CHANGES.md [todo]: https://github.com/MARTIMM/BSON/blob/master/doc/TODO.md