Upgrade Driver Versions
Overview
In this section, you can identify essential changes you must make to your application when you upgrade your driver to a new version.
Before you upgrade, perform the following actions:
Ensure the new version is compatible with the MongoDB Server versions your application connects to and the .NET framework version your application runs on. See the .NET/C# Driver Compatibility page for this information.
Address any breaking changes between the current version of the driver your application is using and your planned upgrade version in the Breaking Changes section. To learn more about the MongoDB Server release compatibility changes, see the Server Release Compatibility Changes section.
Tip
To minimize the number of changes your application may require when upgrading driver versions in the future, use the Stable API.
Breaking Changes
A breaking change is a modification of a convention or a behavior starting in a specific version of the driver. This type of change may prevent your application from working properly if not addressed before upgrading the driver.
The breaking changes in this section are categorized by the driver version that introduced them. When upgrading driver versions, address all the breaking changes between the current and upgrade versions. For example, if you are upgrading the driver from v2.0 to v2.20, address all breaking changes from the version after v2.0 including any listed under v2.20.
Version 2.19.0 Breaking Changes
The
ObjectSerializer
only allows deserialization of types that are considered safe. If not specified otherwise, theObjectSerializer
uses the types returned byObjectSerializer.DefaultAllowedTypes
.To learn more about the
ObjectSerializer
, visit the FAQ. For more information onDefaultAllowedTypes
, visit the API Documentation.The default
LinqProvider
has been changed to LINQ3. TheLinqProvider
can be configured for LINQ2 inMongoClientSettings
as shown in the following code example:var connectionString = "<connection string>"; var clientSettings = MongoClientSettings .FromConnectionString(connectionString); clientSettings.LinqProvider = LinqProvider.V2; var client = new MongoClient(clientSettings);
Version 2.14.0 Breaking Changes
This MongoDB .NET/C# Driver version removed support for .NET framework v4.5.2 or earlier; the minimum .NET framework supported is v4.7.2.
This version of the MongoDB .NET/C# Driver does not support .NET Standard v1.5; the minimum .NET Standard supported is v2.0.
Version 2.13.0 Breaking Changes
The
slave0k
connection string option was removed; thereadPreference
option is now used instead.
Server Release Compatibility Changes
A server release compatibility change is a modification to the MongoDB .NET/C# Driver that discontinues support for a set of MongoDB Server versions.
The driver discontinues support for a MongoDB Server version after it reaches end-of-life (EOL).
To learn more about the MongoDB support for EOL products see the Legacy Support Policy.
To learn more about the compatibility between .NET/C# driver versions and MongoDB Server versions, visit the Compatibility page.
Version 2.14 Release Support Changes
The v2.14 driver drops support for MongoDB Server v3.4 and earlier. To use any driver from v2.14 and later, your MongoDB Server must be v3.6 or later. To learn how to upgrade your MongoDB Server to v3.6, follow the link that corresponds to your MongoDB deployment configuration: