File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,27 @@ import (
1010 "go.mongodb.org/mongo-driver/bson/bsoncodec"
1111)
1212
13- // DefaultRegistry is the default bsoncodec.Registry. It contains the default codecs and the
14- // primitive codecs.
13+ // DefaultRegistry is the default bsoncodec.Registry. It contains the default
14+ // codecs and the primitive codecs.
15+ //
16+ // Deprecated: Use [NewRegistry] to construct a new default registry. To use a
17+ // custom registry when marshaling or unmarshaling, use the "SetRegistry" method
18+ // on an [Encoder] or [Decoder] instead:
19+ //
20+ // dec, err := bson.NewDecoder(bsonrw.NewBSONDocumentReader(data))
21+ // if err != nil {
22+ // panic(err)
23+ // }
24+ // dec.SetRegistry(reg)
25+ //
26+ // See [Encoder] and [Decoder] for more examples.
1527var DefaultRegistry = NewRegistry ()
1628
1729// NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and
1830// decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the
1931// PrimitiveCodecs type in this package.
2032//
21- // Deprecated: Use NewRegistry instead.
33+ // Deprecated: Use [ NewRegistry] instead.
2234func NewRegistryBuilder () * bsoncodec.RegistryBuilder {
2335 rb := bsoncodec .NewRegistryBuilder ()
2436 bsoncodec.DefaultValueEncoders {}.RegisterDefaultEncoders (rb )
You can’t perform that action at this time.
0 commit comments