@@ -156,16 +156,12 @@ type MinKey struct{}
156
156
// MaxKey represents the BSON maxkey value.
157
157
type MaxKey struct {}
158
158
159
- // D represents a BSON Document. This type can be used to represent BSON in a concise and readable
160
- // manner. It should generally be used when serializing to BSON. For deserializing, the Raw or
161
- // Document types should be used.
159
+ // D is an ordered representation of a BSON document. This type should be used when the order of the elements matters,
160
+ // such as MongoDB command documents. If the order of the elements does not matter, an M should be used instead.
162
161
//
163
162
// Example usage:
164
163
//
165
- // primitive.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
166
- //
167
- // This type should be used in situations where order matters, such as MongoDB commands. If the
168
- // order is not important, a map is more comfortable and concise.
164
+ // bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
169
165
type D []E
170
166
171
167
// Map creates a map from the elements of the D.
@@ -183,24 +179,18 @@ type E struct {
183
179
Value interface {}
184
180
}
185
181
186
- // M is an unordered, concise representation of a BSON Document. It should generally be used to
187
- // serialize BSON when the order of the elements of a BSON document do not matter. If the element
188
- // order matters, use a D instead.
182
+ // M is an unordered representation of a BSON document. This type should be used when the order of the elements does not
183
+ // matter. This type is handled as a regular map[string]interface{} when encoding and decoding. Elements will be
184
+ // serialized in an undefined, random order. If the order of the elements matters, a D should be used instead.
189
185
//
190
186
// Example usage:
191
187
//
192
- // primitive.M{"foo": "bar", "hello": "world", "pi": 3.14159}
193
- //
194
- // This type is handled in the encoders as a regular map[string]interface{}. The elements will be
195
- // serialized in an undefined, random order, and the order will be different each time.
188
+ // bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}.
196
189
type M map [string ]interface {}
197
190
198
- // An A represents a BSON array. This type can be used to represent a BSON array in a concise and
199
- // readable manner. It should generally be used when serializing to BSON. For deserializing, the
200
- // RawArray or Array types should be used.
191
+ // An A is an ordered representation of a BSON array.
201
192
//
202
193
// Example usage:
203
194
//
204
- // primitive.A{"bar", "world", 3.14159, primitive.D{{"qux", 12345}}}
205
- //
195
+ // bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}}
206
196
type A []interface {}
0 commit comments