Skip to content

Commit

Permalink
merge v2.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Jul 27, 2024
2 parents 25bf80e + 0d8134e commit df098fa
Show file tree
Hide file tree
Showing 45 changed files with 457 additions and 337 deletions.
10 changes: 0 additions & 10 deletions CSharpDriver.Bson.slnf

This file was deleted.

12 changes: 0 additions & 12 deletions CSharpDriver.Driver.Core.slnf

This file was deleted.

15 changes: 0 additions & 15 deletions CSharpDriver.Driver.slnf

This file was deleted.

94 changes: 1 addition & 93 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,96 +76,4 @@ Contributing

Please see our [guidelines](CONTRIBUTING.md) for contributing to the driver.

### Maintainers:
* Boris Dogadov [email protected]
* James Kovacs [email protected]
* Oleksandr Poliakov [email protected]
* Robert Stam [email protected]

### Contributors:
* Alexander Aramov https://github.com/alex687
* Bar Arnon https://github.com/I3arnon
* Wan Bachtiar https://github.com/sindbach
* Mark Benvenuto https://github.com/markbenvenuto
* Brian Buvinghausen https://github.com/buvinghausen
* Bit Diffusion Limited [email protected]
* Jimmy Bogard https://github.com/jbogard
* Ross Buggins https://github.com/rbugginsvia
* Nima Boscarino https://github.com/NimaBoscarino
* Oscar Bralo https://github.com/Oscarbralo
* Alex Brown https://github.com/alexjamesbrown
* Ethan Celletti https://github.com/Gekctek
* Chris Cho https://github.com/ccho-mongodb
* Adam Avery Cole https://github.com/adamaverycole
* Nate Contino https://github.com/nathan-contino-mongo
* Alex Dawes https://github.com/alexdawes
* Justin Dearing [email protected]
* Dan DeBilt [email protected]
* Teun Duynstee [email protected]
* Einar Egilsson https://github.com/einaregilsson
* Ken Egozi [email protected]
* Alexander Endris https://github.com/AlexEndris
* Daniel Goldman [email protected]
* David Golub https://github.com/dgolub
* Simon Green [email protected]
* Bouke Haarsma https://github.com/Bouke
* James Hadwen [email protected]
* Nuri Halperin https://github.com/nurih
* Daniel Hegener [email protected]
* Nikola Irinchev https://github.com/nirinchev
* Jacob Jewell [email protected]
* Vincent Kam https://github.com/vincentkam
* Danny Kendrick https://github.com/dkendrick
* Ruslan Khasanbaev https://github.com/flaksirus
* Konstantin Khitrykh https://github.com/KonH
* Brian Knight [email protected]
* John Knoop https://github.com/johnknoop
* Andrey Kondratyev https://github.com/byTimo
* Anatoly Koperin https://github.com/ExM
* Nik Kolev [email protected]
* Oleg Kosmakov https://github.com/kosmakoff
* Maksim Krautsou https://github.com/MaKCbIMKo
* Richard Kreuter [email protected]
* Daniel Lee https://github.com/dlee148
* Ming Yau Lee https://github.com/mingyaulee
* Kevin Lewis [email protected]
* Dow Liu [email protected]
* Chuck Lu https://github.com/chucklu
* Alex Lyman [email protected]
* Tomasz Masternak https://github.com/tmasternak
* Mikalai Mazurenka [email protected]
* John Murphy https://github.com/jsmurphy
* Alexander Nagy [email protected]
* Sridhar Nanjundeswaran https://github.com/sridharn
* Nathan https://github.com/terakilobyte
* Adelin Owona https://github.com/adelinowona
* Rachelle Palmer https://github.com/techbelle
* Rich Quackenbush [email protected]
* Carl Reinke https://github.com/mindless2112
* Rodrigo Reis https://github.com/rodrigoreis
* Gian Maria Ricci https://github.com/alkampfergit
* Andrew Rondeau [email protected]
* Ed Rooth [email protected]
* Katie Sadoff https://github.com/ksadoff
* Manas Sahu https://github.com/Zangetsu112
* Sam558 https://github.com/Sam558
* Vladimir Setyaev [email protected]
* Sergey Shushlyapin https://github.com/sergeyshushlyapin
* Alexey Skalozub [email protected]
* Kevin Smith https://github.com/kevbite
* Pete Smith [email protected]
* Matteo Spreafico https://github.com/MatteoSp
* staywellandy https://github.com/staywellandy
* Vyacheslav Stroy https://github.com/kreig
* Jake Sta. Teresa https://github.com/JakeStaTeresa
* Testo [email protected]
* TimTim https://github.com/wegylexy
* Craig Wilson https://github.com/craiggwilson
* Zhmayev Yaroslav https://github.com/salaros
* 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).
Thank you to [everyone](https://github.com/mongodb/mongo-csharp-driver/graphs/contributors) who has contributed to this project.
2 changes: 1 addition & 1 deletion Release Notes/Release Notes v2.25.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ The main new features in 2.25.0 include:

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.25.0%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.25.0}/).
Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.25/).
2 changes: 1 addition & 1 deletion Release Notes/Release Notes v2.26.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ The main new features in 2.26.0 include:

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.26.0%20ORDER%20BY%20key%20ASC).

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

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

NOTICE: MongoDB 3.6 reached end-of-life in April 2021. The .NET/C# Driver will be removing support for MongoDB 3.6 in an upcoming release.

The main new features in 2.28.0 include:

+ Provide Strong-Named Assemblies - [CSHARP-1276](https://jira.mongodb.org/browse/CSHARP-1276)
+ Support additional numeric conversions involving Nullable<T> - [CSHARP-5180](https://jira.mongodb.org/browse/CSHARP-5180)
+ CSFLE/QE KMIP support "delegated" protocol - [CSHARP-4941](https://jira.mongodb.org/browse/CSHARP-4941)

## Bug fixes:
+ Verify that operands to numeric operators in LINQ expressions are represented as numbers on the server - [CSHARP-4985](https://jira.mongodb.org/browse/CSHARP-4985)
+ IReadOnlyDictionary indexer access fails to translate in v3 - [CSHARP-5171](https://jira.mongodb.org/browse/CSHARP-5171)
+ Projection Expressions Fail to Deserialize Data Correctly - [CSHARP-5162](https://jira.mongodb.org/browse/CSHARP-5162)
+ Enum conversion within IQueryable fails with Expression not supported exception - [CSHARP-5043](https://jira.mongodb.org/browse/CSHARP-5043)
+ IMongoCollection.AsQueryable().Select() fails for array type (regression) - [CSHARP-4957](https://jira.mongodb.org/browse/CSHARP-4957)

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.28.0%20ORDER%20BY%20key%20ASC).

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.28/).
Binary file modified packageIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>
<Authors>Etherna Sagl</Authors>
<PackageIcon>packageIcon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>https://github.com/mongodb/mongo-csharp-driver/releases/tag/v$(Version)</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageProjectUrl>https://www.mongodb.com/docs/drivers/csharp/</PackageProjectUrl>
<PackageTags>mongodb;mongo;nosql</PackageTags>
Expand Down Expand Up @@ -50,5 +52,6 @@

<ItemGroup>
<None Include="..\..\packageIcon.png" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion src/MongoDB.Bson/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
// as Xamarin.iOS/Xamarin.Mac.
[assembly: Preserve(AllMembers = true)]

[assembly: InternalsVisibleTo("MongoDB.Bson.Tests")]
[assembly: InternalsVisibleTo("MongoDB.Bson.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010035287f0d3883c0a075c88e0cda3ce93b621003ecbd5e920d4a8c7238564f4d2f4f68116aca28c9b21341dc3a877679c14556192b2b2f5fe2c11d624e0894d308ff7b94bf6fd72aef1b41017ffe2572e99019d1c61963e68cd0ed67734a42cb333b808e3867cbe631937214e32e409fb1fa62fdb69d494c2530e64a40e417d6ee")]
[assembly: InternalsVisibleTo("MongoDB.Analyzer.MQLGenerator, PublicKey=002400000480000094000000060200000024000052534131000400000100010035287f0d3883c0a075c88e0cda3ce93b621003ecbd5e920d4a8c7238564f4d2f4f68116aca28c9b21341dc3a877679c14556192b2b2f5fe2c11d624e0894d308ff7b94bf6fd72aef1b41017ffe2572e99019d1c61963e68cd0ed67734a42cb333b808e3867cbe631937214e32e409fb1fa62fdb69d494c2530e64a40e417d6ee")]
4 changes: 3 additions & 1 deletion src/MongoDB.Bson/Serialization/TypeNameDiscriminator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ public static string GetDiscriminator(Type type)
if (match.Success)
{
var publicKeyToken = match.Groups["token"].Value;
if (publicKeyToken == "null")
if (publicKeyToken == "null" ||
// MongoDB's assemblies should use "type name, assembly name" discriminator format for backward compatibility
(assembly.FullName.StartsWith("MongoDB") && publicKeyToken == "94992a530f44e321"))
{
var dllName = match.Groups["dll"].Value;
assemblyName = dllName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public override string ToString()

private bool CanUseSecondaries(ClusterDescription cluster, List<ServerDescription> servers)
{
if (_mayUseSecondary?.ReadPreference == null || servers.Count == 0)
if (_mayUseSecondary?.ReadPreference == null)
{
return false;
}
Expand All @@ -107,6 +107,11 @@ private bool CanUseSecondaries(ClusterDescription cluster, List<ServerDescriptio
{
case ClusterType.ReplicaSet:
case ClusterType.Sharded:
if (servers.Count == 0)
{
return true;
}

return servers.All(s => _mayUseSecondary.CanUseSecondary(s));

case ClusterType.LoadBalanced:
Expand Down
5 changes: 1 addition & 4 deletions src/MongoDB.Driver.Core/Core/Servers/ServerMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,8 @@ private void Heartbeat(CancellationToken cancellationToken)
ServerDescription newDescription;
if (heartbeatHelloResult != null)
{
var averageRoundTripTime = _roundTripTimeMonitor.Average;
var averageRoundTripTimeRounded = TimeSpan.FromMilliseconds(Math.Round(averageRoundTripTime.TotalMilliseconds));

newDescription = _baseDescription.With(
averageRoundTripTime: averageRoundTripTimeRounded,
averageRoundTripTime: _roundTripTimeMonitor.Average,
canonicalEndPoint: heartbeatHelloResult.Me,
electionId: heartbeatHelloResult.ElectionId,
helloOk: heartbeatHelloResult.HelloOk,
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver.Core/Etherna.MongoDB.Driver.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.100.14" />
<PackageReference Include="DnsClient" Version="1.6.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="MongoDB.Libmongocrypt" Version="1.10.0" />
<PackageReference Include="MongoDB.Libmongocrypt" Version="1.11.0" />
<PackageReference Include="SharpCompress" Version="0.30.1" />
<PackageReference Include="Snappier" Version="1.0.0" />
<PackageReference Include="ZstdSharp.Port" Version="0.7.3" />
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB.Driver.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.TestHelpers")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Legacy")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Core.FunctionalTests")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Core.TestHelpers")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Core.Tests")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Legacy.Tests")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Legacy.TestHelpers")]
[assembly: InternalsVisibleTo("Etherna.MongoDB.Driver.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: InternalsVisibleTo("MongoDB.Analyzer.MQLGenerator, PublicKey=002400000480000094000000060200000024000052534131000400000100010035287f0d3883c0a075c88e0cda3ce93b621003ecbd5e920d4a8c7238564f4d2f4f68116aca28c9b21341dc3a877679c14556192b2b2f5fe2c11d624e0894d308ff7b94bf6fd72aef1b41017ffe2572e99019d1c61963e68cd0ed67734a42cb333b808e3867cbe631937214e32e409fb1fa62fdb69d494c2530e64a40e417d6ee")]
2 changes: 1 addition & 1 deletion src/MongoDB.Driver.GridFS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
// Required for most of the reflection usage in Xamarin.iOS/Xamarin.Mac.
[assembly: Preserve(AllMembers = true)]

[assembly: InternalsVisibleTo("MongoDB.Driver.GridFS.Tests")]
[assembly: InternalsVisibleTo("MongoDB.Driver.GridFS.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010035287f0d3883c0a075c88e0cda3ce93b621003ecbd5e920d4a8c7238564f4d2f4f68116aca28c9b21341dc3a877679c14556192b2b2f5fe2c11d624e0894d308ff7b94bf6fd72aef1b41017ffe2572e99019d1c61963e68cd0ed67734a42cb333b808e3867cbe631937214e32e409fb1fa62fdb69d494c2530e64a40e417d6ee")]
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Etherna.MongoDB.Driver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="MongoDB.Libmongocrypt" Version="1.10.0" />
<PackageReference Include="MongoDB.Libmongocrypt" Version="1.11.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Etherna.MongoDB.Bson;
using Etherna.MongoDB.Driver.Linq.Linq3Implementation.Ast.Expressions;
using Etherna.MongoDB.Driver.Linq.Linq3Implementation.Ast.Filters;
using Etherna.MongoDB.Driver.Linq.Linq3Implementation.Ast.Stages;
using Etherna.MongoDB.Driver.Linq.Linq3Implementation.Ast.Visitors;

namespace Etherna.MongoDB.Driver.Linq.Linq3Implementation.Ast.Optimizers
Expand All @@ -37,6 +36,48 @@ public static TNode SimplifyAndConvert<TNode>(TNode node)
}
#endregion

public override AstNode VisitCondExpression(AstCondExpression node)
{
// { $cond : [{ $eq : [expr1, null] }, null, expr2] }
if (node.If is AstBinaryExpression binaryIfpression &&
binaryIfpression.Operator == AstBinaryOperator.Eq &&
binaryIfpression.Arg1 is AstExpression expr1 &&
binaryIfpression.Arg2 is AstConstantExpression constantComparandExpression &&
constantComparandExpression.Value == BsonNull.Value &&
node.Then is AstConstantExpression constantThenExpression &&
constantThenExpression.Value == BsonNull.Value &&
node.Else is AstExpression expr2)
{
// { $cond : [{ $eq : [expr, null] }, null, expr] } => expr
if (expr1 == expr2)
{
return Visit(expr2);
}

// { $cond : [{ $eq : [expr, null] }, null, { $toT : expr }] } => { $toT : expr } for operators that map null to null
if (expr2 is AstUnaryExpression unaryElseExpression &&
OperatorMapsNullToNull(unaryElseExpression.Operator) &&
unaryElseExpression.Arg == expr1)
{
return Visit(expr2);
}
}

return base.VisitCondExpression(node);

static bool OperatorMapsNullToNull(AstUnaryOperator @operator)
{
return @operator switch
{
AstUnaryOperator.ToDecimal => true,
AstUnaryOperator.ToDouble => true,
AstUnaryOperator.ToInt => true,
AstUnaryOperator.ToLong => true,
_ => false
};
}
}

public override AstNode VisitFieldOperationFilter(AstFieldOperationFilter node)
{
node = (AstFieldOperationFilter)base.VisitFieldOperationFilter(node);
Expand Down Expand Up @@ -281,6 +322,22 @@ bool TrySimplifyAsLet(AstGetFieldExpression node, out AstExpression simplified)
}
}

public override AstNode VisitLetExpression(AstLetExpression node)
{
node = (AstLetExpression)base.VisitLetExpression(node);

// { $let : { vars : { var : expr }, in : "$$var" } } => expr
if (node.Vars.Count == 1 &&
node.Vars[0].Var.Name is string varName &&
node.In is AstVarExpression varExpression &&
varExpression.Name == varName)
{
return node.Vars[0].Value;
}

return node;
}

public override AstNode VisitMapExpression(AstMapExpression node)
{
// { $map : { input : <input>, as : "v", in : "$$v.x" } } => { $getField : { field : "x", input : <input> } }
Expand Down
Loading

0 comments on commit df098fa

Please sign in to comment.