# Packages
Package bsoncodec provides a system for encoding values to BSON representations and decoding values from BSON representations.
Package bsonoptions defines the optional configurations for the BSON codecs.
Package bsonrw contains abstractions for reading and writing BSON and BSON like types from sources.
Package bsontype is a utility package that contains types for each BSON type and the a stringifier for the Type to enable easier debugging when working with BSON.
Package mgocompat provides Registry, a BSON registry compatible with globalsign/mgo's BSON, with some remaining differences.
Package primitive contains types similar to Go primitives for BSON types that do not have direct Go primitive representations.
# Functions
IndentExtJSON will prefix and indent the provided extended JSON src and append it to dst.
Marshal returns the BSON encoding of val as a BSON document.
MarshalAppend will encode val as a BSON document and append the bytes to dst.
MarshalAppendWithContext will encode val as a BSON document using Registry r and EncodeContext ec and append the bytes to dst.
MarshalAppendWithRegistry will encode val as a BSON document using Registry r and append the bytes to dst.
MarshalExtJSON returns the extended JSON encoding of val.
MarshalExtJSONAppend will append the extended JSON encoding of val to dst.
MarshalExtJSONAppendWithContext will append the extended JSON encoding of val to dst using Registry r.
MarshalExtJSONAppendWithRegistry will append the extended JSON encoding of val to dst using Registry r.
MarshalExtJSONIndent returns the extended JSON encoding of val with each line with prefixed and indented.
MarshalExtJSONWithContext returns the extended JSON encoding of val using Registry r.
MarshalExtJSONWithRegistry returns the extended JSON encoding of val using Registry r.
MarshalValue returns the BSON encoding of val.
MarshalValueAppend will append the BSON encoding of val to dst.
MarshalValueAppendWithContext will append the BSON encoding of val to dst using EncodeContext ec.
MarshalValueAppendWithRegistry will append the BSON encoding of val to dst using Registry r.
MarshalValueWithContext returns the BSON encoding of val using EncodeContext ec.
MarshalValueWithRegistry returns the BSON encoding of val using Registry r.
MarshalWithContext returns the BSON encoding of val as a BSON document using EncodeContext ec.
MarshalWithRegistry returns the BSON encoding of val as a BSON document.
NewDecoder returns a new decoder that uses the DefaultRegistry to read from vr.
NewDecoderWithContext returns a new decoder that uses DecodeContext dc to read from vr.
NewEncoder returns a new encoder that uses the DefaultRegistry to write to vw.
NewEncoderWithContext returns a new encoder that uses EncodeContext ec to write to vw.
NewFromIOReader reads a BSON document from the io.Reader and returns it as a bson.Raw.
NewRegistry creates a new Registry configured with the default encoders and decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the PrimitiveCodecs type in this package.
NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the PrimitiveCodecs type in this package.
ReadDocument reads a BSON document from the io.Reader and returns it as a bson.Raw.
Unmarshal parses the BSON-encoded data and stores the result in the value pointed to by val.
UnmarshalExtJSON parses the extended JSON-encoded data and stores the result in the value pointed to by val.
UnmarshalExtJSONWithContext parses the extended JSON-encoded data using DecodeContext dc and stores the result in the value pointed to by val.
UnmarshalExtJSONWithRegistry parses the extended JSON-encoded data using Registry r and stores the result in the value pointed to by val.
UnmarshalValue parses the BSON value of type t with bson.DefaultRegistry and stores the result in the value pointed to by val.
UnmarshalValueWithRegistry parses the BSON value of type t with registry r and stores the result in the value pointed to by val.
UnmarshalWithContext parses the BSON-encoded data using DecodeContext dc and stores the result in the value pointed to by val.
UnmarshalWithRegistry parses the BSON-encoded data using Registry r and stores the result in the value pointed to by val.
# Constants
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
# Variables
DefaultRegistry is the default bsoncodec.Registry.
ErrDecodeToNil is the error returned when trying to decode to a nil value.
ErrNilContext is returned when the provided DecodeContext is nil.
ErrNilReader indicates that an operation was attempted on a nil bson.Reader.
ErrNilRegistry is returned when the provided registry is nil.
# Structs
A Decoder reads and decodes BSON documents from a stream.
An Encoder writes a serialization format to an output stream.
PrimitiveCodecs is a namespace for all of the default bsoncodec.Codecs for the primitive types defined in this package.
RawValue is a raw encoded BSON value.
# Interfaces
Marshaler is the interface implemented by types that can marshal themselves into a valid BSON document.
Unmarshaler is the interface implemented by types that can unmarshal a BSON document representation of themselves.
ValueMarshaler is the interface implemented by types that can marshal themselves into a valid BSON value.
ValueUnmarshaler is the interface implemented by types that can unmarshal a BSON value representation of themselves.
Zeroer allows custom struct types to implement a report of zero state.
# Type aliases
An A is an ordered representation of a BSON array.
D is an ordered representation of a BSON document.
E represents a BSON element for a D.
M is an unordered representation of a BSON document.
Raw is a raw encoded BSON document.
RawElement is a raw encoded BSON document or array element.