|
1 |
| -.. TODO |
| 1 | +.. _golang-upgrade: |
2 | 2 |
|
| 3 | +======================= |
| 4 | +Upgrade Driver Versions |
| 5 | +======================= |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 1 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +.. facet:: |
| 14 | + :name: genre |
| 15 | + :values: reference |
| 16 | + |
| 17 | +.. meta:: |
| 18 | + :keywords: compatibility, backwards compatibility |
| 19 | + |
| 20 | +Overview |
| 21 | +-------- |
| 22 | + |
| 23 | +This page describes the changes you must make to your application |
| 24 | +when you upgrade to a new version of the {+driver-short+}. |
| 25 | + |
| 26 | +Before you upgrade, perform the following actions: |
| 27 | + |
| 28 | +- Ensure the new {+driver-short+} version is compatible with the {+mdb-server+} |
| 29 | + version your application connects to and the Go version your application runs |
| 30 | + on. For more information, see the :ref:`Compatibility <golang-compatibility>` |
| 31 | + page. |
| 32 | + |
| 33 | +- Address any breaking changes between the driver versions your application uses |
| 34 | + and your planned upgrade version in the :ref:`Breaking Changes |
| 35 | + <golang-breaking-changes>` section. |
| 36 | + |
| 37 | +.. tip:: |
| 38 | + |
| 39 | + To minimize the number of changes your application requires when |
| 40 | + upgrading driver versions in the future, use the :ref:`{+stable-api+} <golang-stable-api>`. |
| 41 | + |
| 42 | +.. _golang-breaking-changes: |
| 43 | + |
| 44 | +Breaking Changes |
| 45 | +---------------- |
| 46 | + |
| 47 | +A breaking change is a change of a convention or a behavior starting in a specific |
| 48 | +version of the driver. This type of change may prevent your application from working |
| 49 | +properly if not addressed before upgrading the driver. |
| 50 | + |
| 51 | +The breaking changes in this section are categorized by the driver version that introduced |
| 52 | +them. When upgrading driver versions, address all the breaking changes between the current |
| 53 | +and upgrade versions. |
| 54 | + |
| 55 | +.. _version-2.2-breaking-changes: |
| 56 | + |
| 57 | +Version 2.2 Breaking Changes |
| 58 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 59 | + |
| 60 | +- Drops support for {+mdb-server+} v3.6. The minimum supported {+mdb-server+} |
| 61 | + version is now v4.0. This also drops support for the ``MONGODB-CR`` authentication |
| 62 | + mechanism. To learn more about compatibility with {+mdb-server+} |
| 63 | + versions, see the :ref:`Compatibility <golang-compatibility>` reference. |
| 64 | + |
| 65 | +.. _version-2.0-breaking-changes: |
| 66 | + |
| 67 | +Version 2.0 Breaking Changes |
| 68 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 69 | + |
| 70 | +- ``mongo.Connect()`` does not accept a Context parameter. This |
| 71 | + method accepts only an options object. To view an example that uses this |
| 72 | + method, see the :ref:`Connection Example Code <go-connection-example-code>` |
| 73 | + in the Connection Guide. |
| 74 | + |
| 75 | +- The ``Cursor.SetMaxTime()`` method is renamed to |
| 76 | + ``Cursor.SetMaxAwaitTime()``. This method specifies the maximum time |
| 77 | + that the server waits for new documents retrieved from a capped |
| 78 | + collection with a tailable cursor. |
| 79 | + |
| 80 | +- Removal of operation-specific timeout options. The following fields |
| 81 | + and setter methods have been removed from the driver: |
| 82 | + |
| 83 | + - ``AggregateOptions.MaxTime``, ``AggregateOptions.SetMaxTime()`` |
| 84 | + - ``ClientOptions.SocketTimeout``, ``ClientOptions.SetSocketTimeout()`` |
| 85 | + - ``CountOptions.MaxTime``, ``CountOptions.SetMaxTime()`` |
| 86 | + - ``DistinctOptions.MaxTime``, ``DistinctOptions.SetMaxTime()`` |
| 87 | + - ``EstimatedDocumentCountOptions.MaxTime``, ``EstimatedDocumentCountOptions.SetMaxTime()`` |
| 88 | + - ``FindOptions.MaxTime``, ``FindOptions.SetMaxTime()`` |
| 89 | + - ``FindOneOptions.MaxTime``, ``FindOneOptions.SetMaxTime()`` |
| 90 | + - ``FindOneAndReplaceOptions.MaxTime``, ``FindOneAndReplaceOptions.SetMaxTime()`` |
| 91 | + - ``FindOneAndUpdateOptions.MaxTime``, ``FindOneAndUpdateOptions.SetMaxTime()`` |
| 92 | + - ``GridFSFindOptions.MaxTime``, ``GridFSFindOptions.SetMaxTime()`` |
| 93 | + - ``CreateIndexesOptions.MaxTime``, ``CreateIndexesOptions.SetMaxTime()`` |
| 94 | + - ``DropIndexesOptions.MaxTime``, ``DropIndexesOptions.SetMaxTime()`` |
| 95 | + - ``ListIndexesOptions.MaxTime``, ``ListIndexesOptions.SetMaxTime()`` |
| 96 | + - ``SessionOptions.DefaultMaxCommitTime``, ``SessionOptions.SetDefaultMaxCommitTime()`` |
| 97 | + - ``TransactionOptions.MaxCommitTime``, ``TransactionOptions.SetMaxCommitTime()`` |
| 98 | + - ``WriteConcern.WTimeout`` |
| 99 | + |
| 100 | + Instead, you can set a timeout on your client or within a Context. |
| 101 | + Learn more in the :ref:`golang-csot` guide. |
| 102 | + |
| 103 | +- Removal of the ``bson/primitive`` package. This package is now merged with |
| 104 | + the ``bson`` package. To update your code, remove any ``bson/primitive`` |
| 105 | + import statements and change any instance of ``primitive.ObjectID`` to |
| 106 | + ``bson.ObjectId``. |
0 commit comments