|
| 1 | +.. _csharp-upgrade-driver: |
| 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 | + |
| 14 | +Overview |
| 15 | +-------- |
| 16 | + |
| 17 | +In this section, you can identify essential changes you must make to your |
| 18 | +application when you upgrade your driver to a new version. |
| 19 | + |
| 20 | +Before you upgrade, perform the following actions: |
| 21 | + |
| 22 | +- Ensure the new version is compatible with the MongoDB Server versions |
| 23 | + your application connects to and the {+framework+} version your |
| 24 | + application runs on. See the :ref:`.NET/C# Driver Compatibility <csharp-compatibility-tables>` |
| 25 | + page for this information. |
| 26 | +- Address any breaking changes between the current version of the driver |
| 27 | + your application is using and your planned upgrade version in the |
| 28 | + :ref:`Breaking Changes <csharp-breaking-changes>` section. To learn |
| 29 | + more about the MongoDB Server release compatibility changes, see the |
| 30 | + :ref:`<csharp-server-release-changes>` section. |
| 31 | + |
| 32 | +.. tip:: |
| 33 | + |
| 34 | + To minimize the number of changes your application may require when |
| 35 | + upgrading driver versions in the future, use the |
| 36 | + :ref:`{+stable-api+} <csharp-stable-api>`. |
| 37 | + |
| 38 | +.. _csharp-breaking-changes: |
| 39 | + |
| 40 | +Breaking Changes |
| 41 | +---------------- |
| 42 | + |
| 43 | +A breaking change is a modification of a convention or a behavior starting in |
| 44 | +a specific version of the driver. This type of change may prevent your application from |
| 45 | +working properly if not addressed before upgrading the driver. |
| 46 | + |
| 47 | +The breaking changes in this section are categorized by the driver version that |
| 48 | +introduced them. When upgrading driver versions, address all the breaking |
| 49 | +changes between the current and upgrade versions. For example, if you |
| 50 | +are upgrading the driver from v2.0 to v2.20, address all breaking changes from |
| 51 | +the version after v2.0 including any listed under v2.20. |
| 52 | + |
| 53 | +Version 2.19.0 Breaking Changes |
| 54 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 55 | + |
| 56 | +- The ``ObjectSerializer`` only allows deserialization of |
| 57 | + types that are considered safe. If not specified otherwise, the |
| 58 | + ``ObjectSerializer`` uses the types returned by |
| 59 | + ``ObjectSerializer.DefaultAllowedTypes``. |
| 60 | + |
| 61 | + To learn more about the ``ObjectSerializer``, visit the |
| 62 | + :ref:`FAQ <csharp-faq-object-serializer>`. For more information on |
| 63 | + ``DefaultAllowedTypes``, visit the `API Documentation |
| 64 | + <https://mongodb.github.io/mongo-csharp-driver/2.19/apidocs/html/P_MongoDB_Bson_Serialization_Serializers_ObjectSerializer_DefaultAllowedTypes.htm>`__. |
| 65 | + |
| 66 | +- The default ``LinqProvider`` has been changed to LINQ3. The ``LinqProvider`` |
| 67 | + can be configured for LINQ2 in ``MongoClientSettings`` as shown in the |
| 68 | + following code example: |
| 69 | + |
| 70 | + .. code-block:: csharp |
| 71 | + |
| 72 | + var connectionString = "<connection string>"; |
| 73 | + var clientSettings = MongoClientSettings |
| 74 | + .FromConnectionString(connectionString); |
| 75 | + clientSettings.LinqProvider = LinqProvider.V2; |
| 76 | + var client = new MongoClient(clientSettings); |
| 77 | + |
| 78 | +Version 2.14.0 Breaking Changes |
| 79 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 80 | + |
| 81 | +- This {+driver-long+} version removed support for {+framework+} v4.5.2 or earlier; the minimum |
| 82 | + {+framework+} supported is v4.7.2. |
| 83 | + |
| 84 | +- This version of the {+driver-long+} does not support .NET Standard v1.5; the minimum .NET |
| 85 | + Standard supported is v2.0. |
| 86 | + |
| 87 | +Version 2.13.0 Breaking Changes |
| 88 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 89 | + |
| 90 | +- The ``slave0k`` connection string option was removed; the |
| 91 | + ``readPreference`` option is now used instead. |
| 92 | + |
| 93 | + |
| 94 | +.. _csharp-server-release-changes: |
| 95 | + |
| 96 | +Server Release Compatibility Changes |
| 97 | +------------------------------------ |
| 98 | + |
| 99 | +A server release compatibility change is a modification |
| 100 | +to the {+driver-long+} that discontinues support for a set of |
| 101 | +MongoDB Server versions. |
| 102 | + |
| 103 | +The driver discontinues support for a MongoDB Server version after it |
| 104 | +reaches end-of-life (EOL). |
| 105 | + |
| 106 | +To learn more about the MongoDB support for EOL products see the `Legacy |
| 107 | +Support Policy <https://www.mongodb.com/support-policy/legacy>`__. |
| 108 | + |
| 109 | +To learn more about the compatibility between .NET/C# driver versions |
| 110 | +and MongoDB Server versions, visit the |
| 111 | +:ref:`Compatibility <csharp-compatibility-tables>` page. |
| 112 | + |
| 113 | +Version 2.14 Release Support Changes |
| 114 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 115 | + |
| 116 | +- The v2.14 driver drops support for MongoDB Server v3.4 and earlier. To |
| 117 | + use any driver from v2.14 and later, your MongoDB Server must be v3.6 or |
| 118 | + later. To learn how to upgrade your MongoDB Server to v3.6, follow the |
| 119 | + link that corresponds to your MongoDB deployment configuration: |
| 120 | + |
| 121 | + - :ref:`<3.6-upgrade-replica-set>` |
| 122 | + - :ref:`<3.6-upgrade-standalone>` |
| 123 | + - :ref:`<3.6-upgrade-sharded-cluster>` |
0 commit comments