File: doc.go

package info (click to toggle)
golang-mongodb-mongo-driver 1.8.4%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 18,520 kB
  • sloc: perl: 533; ansic: 491; python: 432; makefile: 187; sh: 72
file content (52 lines) | stat: -rw-r--r-- 2,965 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Package mgocompat provides Registry, a BSON registry compatible with globalsign/mgo's BSON,
// with some remaining differences. It also provides RegistryRespectNilValues for compatibility
// with mgo's BSON with RespectNilValues set to true. A registry can be configured on a
// mongo.Client with the SetRegistry option. See the bsoncodec docs for more details on registries.
//
// Registry supports Getter and Setter equivalents by registering hooks. Note that if a value
// matches the hook for bsoncodec.Marshaler, bsoncodec.ValueMarshaler, or bsoncodec.Proxy, that
// hook will take priority over the Getter hook. The same is true for the hooks for
// bsoncodec.Unmarshaler and bsoncodec.ValueUnmarshaler and the Setter hook.
//
// The functional differences between Registry and globalsign/mgo's BSON library are:
//
// 1) Registry errors instead of silently skipping mismatched types when decoding.
//
// 2) Registry does not have special handling for marshaling array ops ("$in", "$nin", "$all").
//
// The driver uses different types than mgo's bson. The differences are:
//
//     1) The driver's bson.RawValue is equivalent to mgo's bson.Raw, but uses Value instead of Data and uses Type,
//        which is a bsontype.Type object that wraps a byte, instead of bson.Raw's Kind, a byte.
//
//     2) The driver uses primitive.ObjectID, which is a [12]byte instead of mgo's
//        bson.ObjectId, a string. Due to this, the zero value marshals and unmarshals differently
//        for Extended JSON, with the driver marshaling as {"ID":"000000000000000000000000"} and
//        mgo as {"Id":""}. The driver can unmarshal {"ID":""} to a primitive.ObjectID.
//
//     3) The driver's primitive.Symbol is equivalent to mgo's bson.Symbol.
//
//     4) The driver uses primitive.Timestamp instead of mgo's bson.MongoTimestamp. While
//        MongoTimestamp is an int64, primitive.Timestamp stores the time and counter as two separate
//        uint32 values, T and I respectively.
//
//     5) The driver uses primitive.MinKey and primitive.MaxKey, which are struct{}, instead
//        of mgo's bson.MinKey and bson.MaxKey, which are int64.
//
//     6) The driver's primitive.Undefined is equivalent to mgo's bson.Undefined.
//
//     7) The driver's primitive.Binary is equivalent to mgo's bson.Binary, with variables named Subtype
//        and Data instead of Kind and Data.
//
//     8) The driver's primitive.Regex is equivalent to mgo's bson.RegEx.
//
//     9) The driver's primitive.JavaScript is equivalent to mgo's bson.JavaScript with no
//         scope and primitive.CodeWithScope is equivalent to mgo's bson.JavaScript with scope.
//
//     10) The driver's primitive.DBPointer is equivalent to mgo's bson.DBPointer, with variables
//         named DB and Pointer instead of Namespace and Id.
//
//     11) When implementing the Setter interface, mgocompat.ErrSetZero is equivalent to mgo's
//         bson.ErrSetZero.
//
package mgocompat