Skip to content

Commit

Permalink
merge drivers v2.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Mar 21, 2024
2 parents 8230872 + 830b83a commit 65de66c
Show file tree
Hide file tree
Showing 94 changed files with 2,846 additions and 363 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ src/packages
# Cake Artifacts
.dotnet

# Benchmark Artifacts
benchmarks/MongoDB.Driver.Benchmarks/BenchmarkDotNet.Artifacts
benchmarks/MongoDB.Driver.Benchmarks/data

# Other
artifacts
packages
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Documentation

Questions/Bug Reports
---------------------
* [MongoDB Community Forum](https://developer.mongodb.com/community/forums/tags/c/drivers-odms-connectors/7/dot-net-driver)
* [MongoDB Community Forum](https://www.mongodb.com/community/forums/tags/c/data/drivers-odms/7/dot-net)
* [Jira](https://jira.mongodb.org/browse/CSHARP)

If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the [instructions here](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report).
Expand Down Expand Up @@ -165,5 +165,7 @@ Please see our [guidelines](CONTRIBUTING.md) for contributing to the driver.
* Aristarkh Zagorodnikov https://github.com/onyxmaster
* Samir Boulema https://github.com/sboulema
* Dmitry Lukyanov https://github.com/DmitryLukyanov
* Andrea Balducci https://github.com/andreabalducci
* Sergei Lipin https://github.com/prchaoz

If you have contributed and we have neglected to add you to this list please contact one of the maintainers to be added to the list (with apologies).
2 changes: 1 addition & 1 deletion Release Notes/Release Notes v2.23.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ An online version of these release notes is available [here](https://github.com/

The full list of issues resolved in this release is available at [CSHARP JIRA project](https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.23.0%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.23.0/).
Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.23/).
13 changes: 13 additions & 0 deletions Release Notes/Release Notes v2.23.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .NET Driver Version 2.23.1 Release Notes

This is a patch release that addresses some issues reported since 2.23.0 was released.

An online version of these release notes is available [here](https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v2.23.1.md).

The list of JIRA tickets resolved in this release is available at [CSHARP JIRA project](https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.23.1%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.23/).

## Upgrading

There are no known backwards breaking changes in this release.
13 changes: 13 additions & 0 deletions Release Notes/Release Notes v2.23.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .NET Driver Version 2.23.2 Release Notes

This is a patch release that addresses some issues reported since 2.23.1 was released.

An online version of these release notes is available [here](https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v2.23.2.md).

The list of JIRA tickets resolved in this release is available at [CSHARP JIRA project](https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.23.2%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.23/).

## Upgrading

There are no known backwards breaking changes in this release.
27 changes: 27 additions & 0 deletions Release Notes/Release Notes v2.24.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .NET Driver Version 2.24.0 Release Notes

This is the general availability release for the 2.24.0 version of the driver.

The main new features in 2.24.0 include:

* New DistinctMany method in IMongoCollection
* Support for latest $dateFromString optional arguments
* ExceededTimeLimit server error is now retryable for reads as well as writes
* Support sort by score in $search stage
* New custom method to test if a field exists or is missing in LINQ (Mql.Exists, Mql.IsMissing, Mql.IsNullOrMissing)
* Enable TLS 1.3 support
* Fix a GridFS error when attempting to upload a GridFS file with a duplicate id and the new file is smaller than the original file
* Add support for Atlas Search $in operator
* Add support for IComparable CompareTo method in LINQ queries
* Add VectorSearchScore builder for $vectorSearch stage
* Update libmongocrypt package version
* Support for nested AsQueryable in LINQ queries (not a common use case but legal, primarily added for use by the EF Core Provider)
* Updated authentication to occur over OP_MSG on supporting servers to improve MongoDB Atlas Serverless compatibility
* Use polling monitoring when running within a FaaS environment such as AWS Lambda
* Fixed segfault in Kerberos (libgssapi) on newer Linux distros

An online version of these release notes is available [here](https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v2.24.0.md).

The full list of issues resolved in this release is available at [CSHARP JIRA project](https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.24.0%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.24/).
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public byte[] EncryptMessage(byte[] plainTextBytes)

protected override bool ReleaseHandle()
{
var majorStatus = NativeMethods.gss_delete_sec_context(out var minorStatus, handle, IntPtr.Zero);
var majorStatus = NativeMethods.gss_delete_sec_context(out var minorStatus, ref handle, IntPtr.Zero);
return majorStatus == 0 && minorStatus == 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal static class NativeMethods
public static extern uint gss_release_cred(out uint minorStatus, IntPtr credentialHandle);

[DllImport(GSSAPI_LIBRARY)]
public static extern uint gss_delete_sec_context(out uint minorStatus, IntPtr securityContextHandle, IntPtr outputToken);
public static extern uint gss_delete_sec_context(out uint minorStatus, ref IntPtr securityContextHandle, IntPtr outputToken);

[DllImport(GSSAPI_LIBRARY)]
public static extern uint gss_wrap(out uint minorStatus, IntPtr securityContextHandle, int confidentialityRequested, int protectionType, GssInputBuffer inputBuffer, out int confidentialityState, [MarshalAs(UnmanagedType.LPStruct)] GssOutputBuffer outputBuffer);
Expand Down
3 changes: 2 additions & 1 deletion src/MongoDB.Driver.Core/Core/Configuration/ClusterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ private IServerMonitorFactory CreateServerMonitorFactory()
var serverMonitorStreamFactory = CreateTcpStreamFactory(serverMonitorTcpStreamSettings);
var serverMonitorSettings = new ServerMonitorSettings(
connectTimeout: serverMonitorTcpStreamSettings.ConnectTimeout,
heartbeatInterval: _serverSettings.HeartbeatInterval);
heartbeatInterval: _serverSettings.HeartbeatInterval,
serverMonitoringMode: _serverSettings.ServerMonitoringMode);

var serverMonitorConnectionFactory = new BinaryConnectionFactory(
serverMonitorConnectionSettings,
Expand Down
16 changes: 15 additions & 1 deletion src/MongoDB.Driver.Core/Core/Configuration/ConnectionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using System.Linq;
using Etherna.MongoDB.Driver.Core.Authentication;
using Etherna.MongoDB.Driver.Core.Misc;
using Etherna.MongoDB.Shared;

namespace Etherna.MongoDB.Driver.Core.Configuration
{
Expand All @@ -31,6 +30,7 @@ public class ConnectionSettings
private readonly string _applicationName;
private readonly IReadOnlyList<IAuthenticatorFactory> _authenticatorFactories;
private readonly IReadOnlyList<CompressorConfiguration> _compressors;
private readonly LibraryInfo _libraryInfo;
private readonly bool _loadBalanced;
private readonly TimeSpan _maxIdleTime;
private readonly TimeSpan _maxLifeTime;
Expand All @@ -41,20 +41,23 @@ public class ConnectionSettings
/// </summary>
/// <param name="authenticatorFactories">The authenticator factories.</param>
/// <param name="compressors">The compressors.</param>
/// <param name="libraryInfo">The library information.</param>
/// <param name="loadBalanced">Whether the load balanced mode is enabled.</param>
/// <param name="maxIdleTime">The maximum idle time.</param>
/// <param name="maxLifeTime">The maximum life time.</param>
/// <param name="applicationName">The application name.</param>
public ConnectionSettings(
Optional<IEnumerable<IAuthenticatorFactory>> authenticatorFactories = default,
Optional<IEnumerable<CompressorConfiguration>> compressors = default(Optional<IEnumerable<CompressorConfiguration>>),
Optional<LibraryInfo> libraryInfo = default,
Optional<bool> loadBalanced = default,
Optional<TimeSpan> maxIdleTime = default(Optional<TimeSpan>),
Optional<TimeSpan> maxLifeTime = default(Optional<TimeSpan>),
Optional<string> applicationName = default(Optional<string>))
{
_authenticatorFactories = Ensure.IsNotNull(authenticatorFactories.WithDefault(Enumerable.Empty<IAuthenticatorFactory>()), nameof(authenticatorFactories)).ToList().AsReadOnly();
_compressors = Ensure.IsNotNull(compressors.WithDefault(Enumerable.Empty<CompressorConfiguration>()), nameof(compressors)).ToList();
_libraryInfo = libraryInfo.WithDefault(null);
_loadBalanced = loadBalanced.WithDefault(false);
_maxIdleTime = Ensure.IsGreaterThanZero(maxIdleTime.WithDefault(TimeSpan.FromMinutes(10)), "maxIdleTime");
_maxLifeTime = Ensure.IsGreaterThanZero(maxLifeTime.WithDefault(TimeSpan.FromMinutes(30)), "maxLifeTime");
Expand Down Expand Up @@ -95,6 +98,14 @@ public IReadOnlyList<CompressorConfiguration> Compressors
get { return _compressors; }
}

/// <summary>
/// Information about a library using the .NET driver.
/// </summary>
public LibraryInfo LibraryInfo
{
get { return _libraryInfo; }
}

/// <summary>
/// Whether the load balanced mode is enabled.
/// </summary>
Expand Down Expand Up @@ -131,6 +142,7 @@ public TimeSpan MaxLifeTime
/// </summary>
/// <param name="authenticatorFactories">The authenticator factories.</param>
/// <param name="compressors">The compressors.</param>
/// <param name="libraryInfo">The library information.</param>
/// <param name="loadBalanced">Whether the load balanced mode is enabled.</param>
/// <param name="maxIdleTime">The maximum idle time.</param>
/// <param name="maxLifeTime">The maximum life time.</param>
Expand All @@ -139,6 +151,7 @@ public TimeSpan MaxLifeTime
public ConnectionSettings With(
Optional<IEnumerable<IAuthenticatorFactory>> authenticatorFactories = default,
Optional<IEnumerable<CompressorConfiguration>> compressors = default(Optional<IEnumerable<CompressorConfiguration>>),
Optional<LibraryInfo> libraryInfo = default,
Optional<bool> loadBalanced = default,
Optional<TimeSpan> maxIdleTime = default(Optional<TimeSpan>),
Optional<TimeSpan> maxLifeTime = default(Optional<TimeSpan>),
Expand All @@ -147,6 +160,7 @@ public ConnectionSettings With(
return new ConnectionSettings(
authenticatorFactories: Optional.Enumerable(authenticatorFactories.WithDefault(_authenticatorFactories)),
compressors: Optional.Enumerable(compressors.WithDefault(_compressors)),
libraryInfo: libraryInfo.WithDefault(_libraryInfo),
loadBalanced: loadBalanced.WithDefault(_loadBalanced),
maxIdleTime: maxIdleTime.WithDefault(_maxIdleTime),
maxLifeTime: maxLifeTime.WithDefault(_maxLifeTime),
Expand Down
13 changes: 13 additions & 0 deletions src/MongoDB.Driver.Core/Core/Configuration/ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Etherna.MongoDB.Driver.Core.Clusters;
using Etherna.MongoDB.Driver.Core.Compression;
using Etherna.MongoDB.Driver.Core.Misc;
using Etherna.MongoDB.Driver.Core.Servers;

namespace Etherna.MongoDB.Driver.Core.Configuration
{
Expand Down Expand Up @@ -98,6 +99,7 @@ public sealed class ConnectionString
private bool? _retryReads;
private bool? _retryWrites;
private ConnectionStringScheme _scheme;
private ServerMonitoringMode? _serverMonitoringMode;
private TimeSpan? _serverSelectionTimeout;
private TimeSpan? _socketTimeout;
private int? _srvMaxHosts;
Expand Down Expand Up @@ -452,6 +454,14 @@ public ConnectionStringScheme Scheme
get { return _scheme; }
}

/// <summary>
/// Gets the server monitoring mode.
/// </summary>
public ServerMonitoringMode? ServerMonitoringMode
{
get { return _serverMonitoringMode; }
}

/// <summary>
/// Gets the server selection timeout.
/// </summary>
Expand Down Expand Up @@ -1101,6 +1111,9 @@ private void ParseOption(string name, string value)
case "serverselectiontimeoutms":
_serverSelectionTimeout = ParseTimeSpan(name, value);
break;
case "servermonitoringmode":
_serverMonitoringMode = ParseEnum<ServerMonitoringMode>(name, value);
break;
case "sockettimeout":
case "sockettimeoutms":
_socketTimeout = ParseTimeSpan(name, value);
Expand Down
100 changes: 100 additions & 0 deletions src/MongoDB.Driver.Core/Core/Configuration/LibraryInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/* Copyright 2010-present MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using Etherna.MongoDB.Driver.Core.Misc;

namespace Etherna.MongoDB.Driver.Core.Configuration
{
/// <summary>
/// Represents information about a library using the .NET driver.
/// </summary>
public sealed class LibraryInfo : IEquatable<LibraryInfo>
{
/// <summary>
/// Gets the library name.
/// </summary>
public string Name { get; }

/// <summary>
/// Gets the library version.
/// </summary>
public string Version { get; }

// constructors
/// <summary>
/// Initializes a new instance of the <see cref="LibraryInfo"/> class.
/// </summary>
/// <param name="name">The library name.</param>
/// <param name="version">The library version.</param>
public LibraryInfo(string name, string version = default)
{
Name = Ensure.IsNotNullOrEmpty(name, nameof(name));
Version = version;
}

// public operators
/// <summary>
/// Determines whether two <see cref="LibraryInfo"/> instances are equal.
/// </summary>
/// <param name="lhs">The LHS.</param>
/// <param name="rhs">The RHS.</param>
/// <returns>
/// <c>true</c> if the left hand side is equal to the right hand side; otherwise, <c>false</c>.
/// </returns>
public static bool operator ==(LibraryInfo lhs, LibraryInfo rhs)
{
return object.Equals(lhs, rhs); // handles lhs == null correctly
}

/// <summary>
/// Determines whether two <see cref="LibraryInfo"/> instances are not equal.
/// </summary>
/// <param name="lhs">The LHS.</param>
/// <param name="rhs">The RHS.</param>
/// <returns>
/// <c>true</c> if the left hand side is not equal to the right hand side; otherwise, <c>false</c>.
/// </returns>
public static bool operator !=(LibraryInfo lhs, LibraryInfo rhs)
{
return !(lhs == rhs);
}

// public methods
/// <summary>
/// Determines whether the specified <see cref="LibraryInfo" /> is equal to this instance.
/// </summary>
/// <param name="rhs">The <see cref="LibraryInfo" /> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="LibraryInfo" /> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public bool Equals(LibraryInfo rhs)
{
return
rhs != null &&
Name == rhs.Name &&
Version == rhs.Version;
}

/// <inheritdoc/>
public override bool Equals(object obj) => Equals(obj as LibraryInfo);

/// <inheritdoc/>
public override int GetHashCode() => base.GetHashCode();

/// <inheritdoc/>
public override string ToString() => $"{Name}-{Version}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public sealed class LoggingSettings : IEquatable<LoggingSettings>
public ILoggerFactory LoggerFactory { get; }

/// <summary>
/// Gets the maximum document size in chars
/// Gets the maximum document size in chars.
/// </summary>
public int MaxDocumentSize { get; }

Expand Down
Loading

0 comments on commit 65de66c

Please sign in to comment.