2023-06-15 21:22:51 +08:00
|
|
|
//
|
|
|
|
// bson.go
|
|
|
|
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
|
|
|
//
|
|
|
|
// Distributed under terms of the MIT license.
|
|
|
|
//
|
|
|
|
|
|
|
|
package mgodb
|
|
|
|
|
2023-08-13 02:19:19 +08:00
|
|
|
import (
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
2023-08-13 20:03:26 +08:00
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
2023-08-13 02:19:19 +08:00
|
|
|
)
|
2023-06-15 21:22:51 +08:00
|
|
|
|
2023-08-13 02:16:11 +08:00
|
|
|
// M is an unordered representation of a BSON document.
|
|
|
|
// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}
|
2023-06-15 21:22:51 +08:00
|
|
|
type M = bson.M
|
2023-08-13 02:16:11 +08:00
|
|
|
|
|
|
|
// A D should not be constructed with duplicate key names, as that can cause undefined server behavior.
|
|
|
|
// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}}
|
2023-06-15 21:22:51 +08:00
|
|
|
type D = bson.D
|
2023-08-13 02:16:11 +08:00
|
|
|
|
|
|
|
// An A is an ordered representation of a BSON array.
|
|
|
|
// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}}
|
|
|
|
type A = bson.A
|
2023-08-13 02:19:19 +08:00
|
|
|
|
2023-08-13 02:22:04 +08:00
|
|
|
type ObjectID = primitive.ObjectID
|
2023-08-13 20:03:26 +08:00
|
|
|
|
|
|
|
// Collection is a handle to a MongoDB collection. It is safe for concurrent use by multiple goroutines.
|
|
|
|
type Collection = mongo.Collection
|