Skip to content

Commit b177a06

Browse files
authored
Clarify ExtJSON marshaling uses same rules as BSON (#380)
1 parent 7b75c3c commit b177a06

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bson/doc.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
//
7373
// Structs
7474
//
75-
// Structs can be marshalled/unmarshalled to/from BSON. When transforming structs to/from BSON, the following rules
76-
// apply:
75+
// Structs can be marshalled/unmarshalled to/from BSON or Extended JSON. When transforming structs to/from BSON or Extended
76+
// JSON, the following rules apply:
7777
//
7878
// 1. Only exported fields in structs will be marshalled or unmarshalled.
7979
//
@@ -89,7 +89,10 @@
8989
// 5. When unmarshalling, a field of type interface{} will follow the D/M type mappings listed above. BSON documents
9090
// unmarshalled into an interface{} field will be unmarshalled as a D.
9191
//
92-
// The following struct tags can be used to configure behavior:
92+
// The encoding of each struct field can be customized by the "bson" struct tag.
93+
// The tag gives the name of the field, possibly followed by a comma-separated list of options.
94+
// The name may be empty in order to specify options without overriding the default field name. The following options can be used
95+
// to configure behavior:
9396
//
9497
// 1. omitempty: If the omitempty struct tag is specified on a field, the field will not be marshalled if it is set to
9598
// the zero value. By default, a struct field is only considered empty if the field's type implements the Zeroer

0 commit comments

Comments
 (0)