The main API consists of two functions: encode
and decode
, which are the most important functionallity you'll need to implement a MongoDB driver, like cl-MongoDB.
All complies with the BSON spec.
Examples
Setting up with Quicklisp and Named-Readtables:* (ql:quickload :cl-bson)
; => (:CL-BSON)
* (in-package :cl-bson)
; => #<PACKAGE "CL-BSON">
* (named-readtables:in-readtable bson-syntax)
; => big alist of readtables...
* (enable-printers)
; => NIL
* (decode (encode #d("string" "string"
"double" 1.5d0
"embedded" #d("embedded" "document"))))
; => #d("string" "string" "double" 1.5d0 "embedded" #d("embedded" "document"))
* (encode #d("my" "document"))
; => #(22 0 0 0 2 109 121 0 9 0 0 0 100 111 99 117 109 101 110 116 0 0)
* (decode *)
; => #d("my" "document")
Main API
No node with name
encode
.No node with name
decode
.