Skip to content

Commit 692114e

Browse files
benjirewisBenjamin Rewis
authored andcommitted
GODRIVER-852 Add documentation warning against the use of duplicate key names (#614)
1 parent 3525304 commit 692114e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

bson/bson.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type Zeroer interface {
2525
// D is an ordered representation of a BSON document. This type should be used when the order of the elements matters,
2626
// such as MongoDB command documents. If the order of the elements does not matter, an M should be used instead.
2727
//
28+
// A D should not be constructed with duplicate key names, as that can cause undefined server behavior.
29+
//
2830
// Example usage:
2931
//
3032
// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}

bson/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
// slice and M is a map. For more information about the use cases for these types, see the documentation on the type
3030
// definitions.
3131
//
32+
// Note that a D should not be constructed with duplicate key names, as that can cause undefined server behavior.
33+
//
3234
// Example:
3335
// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
3436
// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}

0 commit comments

Comments
 (0)