Module Mongoc.Bson

Binding of the BSON library, libbson

module Error : sig ... end

BSON error encapsulation

type t

Binary JSON document abstration.

val new_from_json : ?length:int -> string -> (t, Error.t) Stdlib.result

new_from_json data function allocates and initializes a new t by parsing the JSON found in data. Only a single JSON object may exist in data or an error will be returned.

val as_canonical_extended_json : ?length:int -> t -> string

as_canonical_extended_json bson encodes bson as a UTF-8 string in Canonical Extended JSON. See MongoDB Extended JSON format for a description of Extended JSON formats.

val as_relaxed_extended_json : ?length:int -> t -> string

as_relaxed_extended_json bson encodes bson as a UTF-8 string in Relaxed Extended JSON. See MongoDB Extended JSON format for a description of Extended JSON formats.

val as_json : ?length:int -> t -> string

Same as as_relaxed_extended_json

val destroy : t -> unit

The destroy function shall free an allocated t document.