Docs Menu

Docs HomeDevelop ApplicationsMongoDB DriversC#/.NET

Upgrade Driver Versions

On this page

  • Overview
  • Breaking Changes
  • Server Release Compatibility Changes

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.

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 ObjectSerializer only allows deserialization of types that are considered safe. If not specified otherwise, the ObjectSerializer uses the types returned by ObjectSerializer.DefaultAllowedTypes.

    To learn more about the ObjectSerializer, visit the FAQ. For more information on DefaultAllowedTypes, visit the API Documentation.

  • The default LinqProvider has been changed to LINQ3. The LinqProvider can be configured for LINQ2 in MongoClientSettings 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);
  • 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.

  • The slave0k connection string option was removed; the readPreference option 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.

← Compatibility