Decode binary data from a Buf
The mongodb server returns data in binary form. This must be decoded to access the document properly.
Note that when using the MongoDB driver package, the driver will handle the encoding and decoding.
unit class BSON::Decode:auth<github:MARTIMM>;
my BSON::Document $d0 .= new: ( :1bread, :66eggs);
my Buf $b = BSON::Encode.new.encode($d0);
…
my BSON::Document $d1 = BSON::Decode.decode($b);
Decode binary data
method decode ( Buf:D $data --> BSON::Document )