Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Marshal = bson.Marshal
Marshal bson.Marshal
var NewObjectID = primitive.NewObjectID
NewObjectID primitive.NewObjectID
var ObjectIDHex = primitive.ObjectIDFromHex
ObjectIDHex primitive.ObjectIDFromHex
Functions ¶
func IsObjectIDHex ¶
IsObjectIDHex returns whether s is a valid hex representation of an ObjectId. See the ObjectIdHex function.
Types ¶
type A ¶
An A represents a BSON array. This type can be used to represent a BSON array in a concise and readable manner. It should generally be used when serializing to BSON. For deserializing, the RawArray or Array types should be used.
Example usage:
bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}}
type D ¶
D represents a BSON Document. This type can be used to represent BSON in a concise and readable manner. It should generally be used when serializing to BSON. For deserializing, the Raw or Document types should be used.
Example usage:
bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
This type should be used in situations where order matters, such as MongoDB commands. If the order is not important, a map is more comfortable and concise.
type M ¶
M is an unordered, concise representation of a BSON Document. It should generally be used to serialize BSON when the order of the elements of a BSON document do not matter. If the element order matters, use a D instead.
Example usage:
bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}
This type is handled in the encoders as a regular map[string]interface{}. The elements will be serialized in an undefined, random order, and the order will be different each time.