Learn what's new in:
What's New in 3.0
Warning
Breaking Changes in v3.0
The v3.0 driver contains breaking changes. See Version 3.0 Breaking Changes for more information.
The 3.0 driver release includes the following new features:
Adds the
MongoClientSettings.TranslationOptionsconnection option, which specifies options for translating LINQ queries to the Query API. See Specify Connection Options for more information.Adds support for the
Halftype, which represents a half-precision floating-point number. This type is available in .NET 5 and later. To learn more about theHalftype, see the Half Struct API reference page on MSDN.The
IMongoClientinterface inherits theIDisposableinterface. As a result, theMongoClientclass and other classes that implement theIMongoClientinterface contain aDisp- Adds support for the ``sortoption to be passed to update commands.ose()`` method, which disposes of the client. This method does not dispose the underlying cluster and connections to the MongoDB server. To dispose of the cluster and connections, call theClusterRegistry.UnregisterAndDisposeCluster()method. The implementation of theIDisposableinterface is experimental.To learn more about the
IDisposableinterface and use of theDispose()method, see Dispose Pattern on MSDN.Adds support for the
DateOnlytype, which represents a date value with no time component. This type is available in .NET 6 and later. To learn more about theDateOnlytype, see the DateOnly Struct. API reference page on MSDN.Adds support for the
TimeOnlytype, which represents a time value with no date component. This type is available in .NET 6 and later. To learn more about theTimeOnlytype, see the TimeOnly Struct. API reference page on MSDN.Adds support for implicit client-side projection when using the
Find()method, theSelect()method, or theProject()aggregation stage with the LINQ3 provider. In previous versions of the driver, you could perform client-side projection with the LINQ3 provider only after calling theToEnumerable()orAsEnumerable()method.To learn how to enable and use client-side projection for a driver method, select the corresponding tab:
// Enable client-side projection var findOptions = new FindOptions(); findOptions.TranslationOptions = new ExpressionTranslationOptions { EnableClientSideProjections = true }; var find = collection .Find(doc => doc.Id == 1, findOptions); .Project(doc => new { R = MyFunction(doc.Name) }); // Enable client-side projection var aggregateOptions = new AggregateOptions(); aggregateOptions.TranslationOptions = new ExpressionTranslationOptions { EnableClientSideProjections = true }; var queryable = collection .AsQueryable(aggregateOptions) .Where(doc => doc.Id == 1) .Select(doc => new { R = MyFunction(doc.Name) }); // Enable client-side projection var aggregateOptions = new AggregateOptions(); aggregateOptions.TranslationOptions = new ExpressionTranslationOptions { EnableClientSideProjections = true }; var aggregate = collection .Aggregate(aggregateOptions) .Project(doc => new { R = MyFunction(doc.Name) }); Tip
MongoClientSettings
To enable client-side projection for all queries on a client, set the
TranslationOptionsproperty of yourMongoClientSettingsobject, as shown in the following example:clientSettings.TranslationOptions = new ExpressionTranslationOptions { EnableClientSideProjections = true }; To learn more about using the aggregation pipeline with the .NET/C# Driver, see Aggregation Operations.
Adds a
MongoClientAPI for bulk write operations. To learn more about bulk write operations, see Bulk Write Operations.
For more information about this release, see the v3.0 release notes.
What's New in 2.30
The 2.30 driver doesn't introduce new features or bug fixes. Its purpose is to ease migration to v3.x of the .NET/C# Driver by marking the public APIs that were removed in v3.0 as obsolete.
What's New in 2.29
The 2.29 driver release adds support for MongoDB Server version 8.0 and includes the following new features:
Adds support for v2 of the Queryable Encryption range protocol.
Adds support for range indexes for Queryable Encryption. For more information about Queryable Encryption, see Queryable Encryption in the MongoDB Server manual.
For more information about this release, see the v2.29 release notes.
What's New in 2.28
Warning
Potential Breaking Change in v2.28
All .NET/C# Driver components are strongly named. If your application has dependencies that reference multiple .NET/C# Driver versions, you must create binding redirects to manage those dependencies. For more information, see Version 2.28.0 Breaking Change.
The 2.28 driver release includes the following new features:
Adds support for additional numeric conversions involving
Nullable<T>.Adds support for the
delegatedoption when using KMIP for CSFLE or Queryable Encryption.
For more information about this release, see the v2.28 release notes.
What's New in 2.27
The 2.27 driver release includes the following new features:
Adds support for the
$sampleaggregation operator.Implements the
Equals()method for serializers in LINQ3.Ensures that read and write concerns are not applied to Atlas Search Index Helper commands to avoid errors.
Disallows the use of the comma character in
authMechanismPropertiesconnection string values when using theMONGODB-OIDCauthentication mechanism.Fixes a translation bug that caused an error during serialization involving numbers of different sizes.
Adds support for Linux distributions that use the
libdl.so.2library.
For more information about this release, see the v2.27 release notes.
What's New in 2.26
The 2.26 driver release includes the following new features:
Added support for using the
SelectMany()aggregation method withinSelect()andProject()aggregation stages.Added support for
Dictionary.ContainsValue()calls in LINQ queries.Added support for string concatenation of mixed types.
Enabled use of native
cryptoinlibmongocryptbindings.Added support for serialization of
MemoryandReadOnlyMemorystructs. To learn more about implementing these types, see the Improve Array Serialization Performance section of the Serialization guide.Added support for the GCP Identity Provider when using the
MONGODB-OIDCauthentication mechanism. To learn more, see GCP IMDS in the Enterprise Authentication Mechanisms guide.Implemented signing of NuGet packages.
Implemented read and write retries to other
mongosinstances when possible.
What's New in 2.25
The 2.25 driver release includes the following new features:
Added support for the
MONGODB-OIDCauthentication mechanism and automatic token acquisition for Azure Identity Provider.Added the class name to the error message reported when
BsonClassMapSerializercannot locate a matching creator.Added a
LoggedStagesfield to surface the MQL executed after performing a LINQ query.Added support for overriding the
"mongodb"service name with a custom one by using thesrvServiceNameconnection option. To learn more, see the Specify Connection Options guide.Improved behavior of bulk write operations to prevent enumerating the requests parameter more than once.
What's New in 2.24
The 2.24 driver release includes the following new features:
Added the IMongoCollection.DistinctMany() method.
Added support for the latest optional arguments for the $dateFromString aggregation expression.
Added support for sorting by score in the $search aggregation stage.
Added the
VectorSearchScorebuilder for the $vectorSearch aggregation stage.Added support for the $in operator in Atlas Search.
Added the
Mql.Exists(),Mql.IsMissing(), andMql.IsNullOrMissing()methods for LINQ queries.Added support for the
IComparable.CompareTo()method in LINQ queries.Added support for nested calls to the
AsQueryable()method to support LINQ queries by the MongoDB Entity Framework Core Provider.Added support for TLS 1.3.
Updated the
libmongocryptpackage version to 1.8.2.Fixed a segfault in Kerberos (
libgssapi) on newer Linux distributions.Fixed a GridFS bug in which downloading a file caused an error if a larger file with the same ID had also been uploaded.
The
ExceededTimeLimitserver error is now retryable for both read and write operations.When running within a function-as-a-service (FaaS) environment, such as AWS Lambda, the driver now uses the polling monitoring mechanism.
To improve MongoDB Atlas Serverless compatibility, the driver now uses OP_MSG for authentication if the server supports it.
What's New in 2.23
The 2.23 driver release includes the following new features:
Improvements and bug fixes to the LINQ3 integration.
Added support for aggregation bitwise operators.
Added support for the
$outoperator in MongoDB time series collections.Added ChangeStreamSplitLargeEvent to handle change stream events greater than 16 MB.
What's New in 2.22
The 2.22 driver release includes the following new features:
Improvements and bug fixes to the LINQ3 integration.
Added support for $set and $vectorSearch aggregation stages.
Added synonym support for Atlas Search.
Reduced memory allocation when using encryption.
Added logging messages for server discovery and monitoring (SDAM) events. For more information on these events, see the MongoDB SDAM Logging and Monitoring specification.