1// Copyright (C) MongoDB, Inc. 2017-present.
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may
4// not use this file except in compliance with the License. You may obtain
5// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6//
7// Based on gopkg.in/mgo.v2/bson by Gustavo Niemeyer
8// See THIRD-PARTY-NOTICES for original license terms.
9
10// +build go1.9
11
12package bson // import "go.mongodb.org/mongo-driver/bson"
13
14import (
15	"go.mongodb.org/mongo-driver/bson/primitive"
16)
17
18// Zeroer allows custom struct types to implement a report of zero
19// state. All struct types that don't implement Zeroer or where IsZero
20// returns false are considered to be not zero.
21type Zeroer interface {
22	IsZero() bool
23}
24
25// D is an ordered representation of a BSON document. This type should be used when the order of the elements matters,
26// such as MongoDB command documents. If the order of the elements does not matter, an M should be used instead.
27//
28// Example usage:
29//
30// 		bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
31type D = primitive.D
32
33// E represents a BSON element for a D. It is usually used inside a D.
34type E = primitive.E
35
36// M is an unordered representation of a BSON document. This type should be used when the order of the elements does not
37// matter. This type is handled as a regular map[string]interface{} when encoding and decoding. Elements will be
38// serialized in an undefined, random order. If the order of the elements matters, a D should be used instead.
39//
40// Example usage:
41//
42// 		bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}
43type M = primitive.M
44
45// An A is an ordered representation of a BSON array.
46//
47// Example usage:
48//
49// 		bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}}
50type A = primitive.A
51