|
4 | 4 | What's New
|
5 | 5 | ==========
|
6 | 6 |
|
7 |
| -.. default-domain:: mongodb |
8 |
| - |
9 | 7 | .. contents:: On this page
|
10 | 8 | :local:
|
11 | 9 | :backlinks: none
|
@@ -45,6 +43,84 @@ What's New in 1.12
|
45 | 43 | deprecated. You can create a client and connect in one call
|
46 | 44 | by using the ``mongo.Connect()`` method.
|
47 | 45 |
|
| 46 | +New features of the 1.12 Go driver release include: |
| 47 | + |
| 48 | +Queryable Encryption |
| 49 | +~~~~~~~~~~~~~~~~~~~~ |
| 50 | + |
| 51 | +This driver version adds support for :ref:`qe-manual-feature-qe` (QE). To learn |
| 52 | +more about the requirements for using the QE feature, see the |
| 53 | +:ref:`Queryable Encryption Driver Compatibility Table |
| 54 | +<qe-compatibility-reference>`. |
| 55 | + |
| 56 | +The ``ClientEncryption.CreateEncryptedCollection()`` |
| 57 | +method automatically creates data encryption keys when |
| 58 | +you create a new encrypted collection. To learn how to use the QE |
| 59 | +feature, see the :ref:`qe-quick-start` in the Server manual. |
| 60 | + |
| 61 | +Logging Interface |
| 62 | +~~~~~~~~~~~~~~~~~ |
| 63 | + |
| 64 | +You can now record connection management and command execution events by |
| 65 | +using the ``LogSink`` logging interface. |
| 66 | + |
| 67 | +The ``LogSink`` interface is |
| 68 | +compatible with the `logr.LogSink <https://pkg.go.dev/github.com/go-logr/logr#LogSink>`__ interface. |
| 69 | +You can use existing ``logr`` adapters with the logging interface |
| 70 | +such as :github:`zerologr <go-logr/zerologr>` or :github:`zapr <go-logr/zapr>`. |
| 71 | + |
| 72 | +Alternatively, you can implement your own ``LogSink`` adapter. The following |
| 73 | +example shows how to implement logging with an existing :github:`zerolog |
| 74 | +<rs/zerolog>` logger, called ``myLogger``: |
| 75 | + |
| 76 | +.. code-block:: go |
| 77 | + |
| 78 | + sink := zerologr.New(&myLogger).GetSink() |
| 79 | + loggerOptions := options.Logger().SetSink(sink) |
| 80 | + options.Client().SetLoggerOptions(loggerOptions) |
| 81 | + |
| 82 | +Additional BSON Marshalling Options |
| 83 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 84 | + |
| 85 | +This driver version adds features to the ``options`` package to specify |
| 86 | +how the driver marshals and unmarshals BSON. |
| 87 | + |
| 88 | +The following example shows how to set BSON options on your |
| 89 | +``Client``. The options specify the following behaviors: |
| 90 | + |
| 91 | +- The driver falls back to ``json`` :ref:`struct tags |
| 92 | + <golang-struct-tags>` if ``bson`` struct tags are absent. |
| 93 | +- The driver marshals ``nil`` Go map types as empty BSON documents. |
| 94 | +- The driver marshals ``nil`` Go slice types as empty BSON arrays. |
| 95 | + |
| 96 | +.. code-block:: go |
| 97 | + |
| 98 | + bsonOpts := &options.BSONOptions{ |
| 99 | + UseJSONStructTags: true, |
| 100 | + NilMapAsEmpty: true, |
| 101 | + NilSliceAsEmpty: true, |
| 102 | + } |
| 103 | + options.Client().SetBSONOptions(bsonOpts) |
| 104 | + |
| 105 | +For a full example of how to specify and implement the ``BSONOptions`` |
| 106 | +type, see the `API documentation <{+api+}/mongo#example-Connect-BSONOptions>`__. |
| 107 | + |
| 108 | +Simplified Write Concern Specification |
| 109 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 110 | + |
| 111 | +This driver version simplifies the ``WriteConcern`` API. To learn more about |
| 112 | +the changes, see :ref:`Write Concern <golang-writeconcern>`. |
| 113 | + |
| 114 | +Additional Changes |
| 115 | +~~~~~~~~~~~~~~~~~~ |
| 116 | + |
| 117 | +- Support for authentication with AWS IAM roles in EKS. |
| 118 | +- Addition of the ``Cursor.SetBatchSize()`` method to allow |
| 119 | + specification of the size of batches fetched when iterating through a |
| 120 | + cursor. |
| 121 | +- Addition of the ``UnmarshalValue()`` method to allow ummarshalling of |
| 122 | + BSON values marshalled with the ``MarshalValue()`` method. |
| 123 | + |
48 | 124 | .. _version-1.11.0:
|
49 | 125 | .. _version-1.11:
|
50 | 126 |
|
|
0 commit comments