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.
To minimize the number of changes your application may require when upgrading driver versions in the future, use the Stable API.
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.
The function signature of
Rendermethods in the Atlas Search builders changed. The following code snippet shows the function signature prior to the change and after the change:
// Render function signature prior to v2.21.0 Render(IBsonSerializer<TDocument> documentSerializer, IBsonSerializerRegistry serializerRegistry); // Render function signature in v2.21.0 and later Render(SearchDefinitionRenderContext<TDocument> renderContext);
ObjectSerializeronly allows deserialization of types that are considered safe. If not specified otherwise, the
ObjectSerializeruses the types returned by
LinqProviderhas been changed to LINQ3. The
LinqProvidercan be configured for LINQ2 in
MongoClientSettingsas shown in the following code example:
var connectionString = "<connection string>"; var clientSettings = MongoClientSettings .FromConnectionString(connectionString); clientSettings.LinqProvider = LinqProvider.V2; var client = new MongoClient(clientSettings);
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.
slave0kconnection string option was removed; the
readPreferenceoption is now used instead.
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.
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: