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 (
10
10
"go.mongodb.org/mongo-driver/bson/bsoncodec"
11
11
)
12
12
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.
15
27
var DefaultRegistry = NewRegistry ()
16
28
17
29
// NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and
18
30
// decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the
19
31
// PrimitiveCodecs type in this package.
20
32
//
21
- // Deprecated: Use NewRegistry instead.
33
+ // Deprecated: Use [ NewRegistry] instead.
22
34
func NewRegistryBuilder () * bsoncodec.RegistryBuilder {
23
35
rb := bsoncodec .NewRegistryBuilder ()
24
36
bsoncodec.DefaultValueEncoders {}.RegisterDefaultEncoders (rb )
You can’t perform that action at this time.
0 commit comments