2 BSON
(require net/bson) | package: mongodb |
MongoDB depends on BSON. This module contains an encoding of BSON values as Scheme values.
A BSON document is a dictionary that maps symbols to BSON values.
A BSON sequence is sequence of BSON values.
value
value
A few BSON types do not have equivalents in Scheme.
procedure
(bson-min-key? x) → boolean?
x : any/c
value
procedure
(bson-max-key? x) → boolean?
x : any/c
value
procedure
(bson-null? x) → boolean?
x : any/c
value
struct
(struct bson-timestamp (value) #:extra-constructor-name make-bson-timestamp) value : int64?
procedure
(bson-objectid? x) → boolean?
x : any/c
procedure
procedure
oid : bson-objectid?
A few BSON types have equivalents in Scheme, but because of additional tagging of them in BSON, we have to create structures to preserve the tagging.
struct
(struct bson-javascript (string) #:extra-constructor-name make-bson-javascript) string : string?
struct
(struct bson-javascript/scope (string scope) #:extra-constructor-name make-bson-javascript/scope) string : string? scope : bson-document/c
struct
(struct bson-binary (type bs) #:extra-constructor-name make-bson-binary) type : (symbols 'function 'binary 'uuid 'md5 'user-defined) bs : bytes?
struct
(struct bson-regexp (pattern options) #:extra-constructor-name make-bson-regexp) pattern : string? options : string?
2.1 Decoding Conventions
Only make-hasheq dictionaries are returned as BSON documents.
A bson-binary? where bson-binary-type is equal to 'binary is never returned. It is converted to bytes?.
Only vector sequences are returned as BSON sequences.