Skip to content

Commit

Permalink
merge v2.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Sep 19, 2024
2 parents 5c89236 + c4f48da commit bafaef8
Show file tree
Hide file tree
Showing 57 changed files with 1,008 additions and 683 deletions.
17 changes: 17 additions & 0 deletions Release Notes/Release Notes v2.29.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .NET Driver Version 2.29.0 Release Notes

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

Version 2.29.0 of the driver has been tested against MongoDB Server version 8.0 and adds support for the following new features in server version 8.0:

+ Support for v2 of the Queryable Encryption range protocol - [CSHARP-4959](https://jira.mongodb.org/browse/CSHARP-4959)
+ Range indexes for Queryable Encryption are now GA - [CSHARP-5057](https://jira.mongodb.org/browse/CSHARP-5057)

The following server 8.0 features are not yet supported and will be supported in a later release of the driver:

+ Improved Bulk Write API - [CSHARP-4145](https://jira.mongodb.org/browse/CSHARP-4145)
+ Update Sort option - [CSHARP-5201](https://jira.mongodb.org/browse/CSHARP-5201)

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

Documentation on the .NET driver can be found [here](https://www.mongodb.com/docs/drivers/csharp/v2.29/).
6 changes: 5 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<Compile Include="..\MongoDB.Shared\IsExternalInit.cs" Visible="false" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\packageIcon.png" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
</Project>
7 changes: 7 additions & 0 deletions src/MongoDB.Driver.Core/Core/Misc/Feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class Feature
private static readonly Feature __createIndexesUsingInsertOperations = new Feature("CreateIndexesUsingInsertOperations", WireVersion.Zero, WireVersion.Server42);
private static readonly Feature __csfleRangeAlgorithm = new Feature("CsfleRangeAlgorithm", WireVersion.Server62);
private static readonly Feature __csfle2Qev2RangePreviewAlgorithm = new Feature("csfle2Qev2RangePreviewAlgorithm", WireVersion.Server70, WireVersion.Server80);
private static readonly Feature __csfle2Qev2RangeAlgorithm = new Feature("csfle2Qev2RangeAlgorithm", WireVersion.Server80);
private static readonly Feature __csfle2 = new Feature("Csfle2", WireVersion.Server60);
private static readonly Feature __csfle2Qev2 = new Feature("Csfle2Qev2", WireVersion.Server70, notSupportedMessage: "Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.");
private static readonly Feature __currentOpCommand = new Feature("CurrentOpCommand", WireVersion.Server32);
Expand Down Expand Up @@ -374,8 +375,14 @@ public class Feature
/// <summary>
/// Gets the csfle2 range preview algorithm feature.
/// </summary>
[Obsolete("This property will be removed in a later release. Please use Csfle2QEv2RangeAlgorithm with server 8.0 and higher.")]
public static Feature Csfle2QEv2RangePreviewAlgorithm => __csfle2Qev2RangePreviewAlgorithm;

/// <summary>
/// Gets the csfle2 range algorithm feature.
/// </summary>
public static Feature Csfle2QEv2RangeAlgorithm => __csfle2Qev2RangeAlgorithm;

/// <summary>
/// Gets the current op command feature.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver.Core/Core/Misc/WireVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ internal static class WireVersion
new WireVersionInfo(wireVersion: 25, major: 8, minor: 0),
};

private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: 6, maxWireVersion: 24);
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: 6, maxWireVersion: 25);

private static Range<int> CreateSupportedWireVersionRange(int minWireVersion, int maxWireVersion)
{
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 @@ -27,7 +27,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.11.0" />
<PackageReference Include="MongoDB.Libmongocrypt" Version="1.12.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
5 changes: 3 additions & 2 deletions src/MongoDB.Driver.GridFS/GridFSBucket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,9 @@ private FindOperation<GridFSFileInfo<TFileId>> CreateFindOperation(FilterDefinit
var filesCollectionNamespace = this.GetFilesCollectionNamespace();
var messageEncoderSettings = this.GetMessageEncoderSettings();
var linqProvider = _database.Client.Settings.LinqProvider;
var renderedFilter = filter.Render(_fileInfoSerializer, _options.SerializerRegistry, linqProvider);
var renderedSort = options.Sort == null ? null : options.Sort.Render(_fileInfoSerializer, _options.SerializerRegistry, linqProvider);
var args = new RenderArgs<GridFSFileInfo<TFileId>>(_fileInfoSerializer, _options.SerializerRegistry, linqProvider);
var renderedFilter = filter.Render(args);
var renderedSort = options.Sort == null ? null : options.Sort.Render(args);

return new FindOperation<GridFSFileInfo<TFileId>>(
filesCollectionNamespace,
Expand Down
5 changes: 2 additions & 3 deletions src/MongoDB.Driver.GridFS/GridFSBucketCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -242,7 +241,7 @@ private IEnumerable<GridFSFileInfo> TransformFileInfos(IEnumerable<GridFSFileInf
private FilterDefinition<GridFSFileInfo<ObjectId>> WrapFilter(FilterDefinition<GridFSFileInfo> filter)
{
var linqProvider = Database.Client.Settings.LinqProvider;
var renderedFilter = filter.Render(GridFSFileInfoSerializer.Instance, BsonSerializer.GetSerializerRegistry(), linqProvider);
var renderedFilter = filter.Render(new(GridFSFileInfoSerializer.Instance, BsonSerializer.GetSerializerRegistry(), linqProvider));
return new BsonDocumentFilterDefinition<GridFSFileInfo<ObjectId>>(renderedFilter);
}

Expand All @@ -251,7 +250,7 @@ private GridFSFindOptions<ObjectId> WrapFindOptions(GridFSFindOptions options)
if (options != null)
{
var linqProvider = Database.Client.Settings.LinqProvider;
var renderedSort = options.Sort == null ? null : options.Sort.Render(GridFSFileInfoSerializer.Instance, BsonSerializer.GetSerializerRegistry(), linqProvider);
var renderedSort = options.Sort == null ? null : options.Sort.Render(new(GridFSFileInfoSerializer.Instance, BsonSerializer.GetSerializerRegistry(), linqProvider));
var wrappedSort = renderedSort == null ? null : new BsonDocumentSortDefinition<GridFSFileInfo<ObjectId>>(renderedSort);
return new GridFSFindOptions<ObjectId>
{
Expand Down
25 changes: 18 additions & 7 deletions src/MongoDB.Driver/AggregateExpressionDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,18 @@ public static implicit operator AggregateExpressionDefinition<TSource, TResult>(
/// <param name="serializerRegistry">The serializer registry.</param>
/// <param name="linqProvider">The LINQ provider.</param>
/// <returns>The rendered aggregation expression.</returns>
public abstract BsonValue Render(IBsonSerializer<TSource> sourceSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider);
[Obsolete("Use Render(RenderArgs<TSource> args) overload instead.")]
public virtual BsonValue Render(IBsonSerializer<TSource> sourceSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
{
return Render(new(sourceSerializer, serializerRegistry, linqProvider));
}

/// <summary>
/// Renders the aggregation expression to a <see cref="BsonValue"/>.
/// </summary>
/// <param name="args">The render arguments.</param>
/// <returns>A <see cref="BsonValue"/>.</returns>
public abstract BsonValue Render(RenderArgs<TSource> args);
}

/// <summary>
Expand All @@ -101,7 +112,7 @@ public BsonValueAggregateExpressionDefinition(BsonValue expression)

// public methods
/// <inheritdoc/>
public override BsonValue Render(IBsonSerializer<TSource> sourceSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
public override BsonValue Render(RenderArgs<TSource> args)
{
return _expression;
}
Expand Down Expand Up @@ -143,10 +154,10 @@ internal ExpressionAggregateExpressionDefinition(

// public methods
/// <inheritdoc/>
public override BsonValue Render(IBsonSerializer<TSource> sourceSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
public override BsonValue Render(RenderArgs<TSource> args)
{
var contextData = _contextData?.With("SerializerRegistry", serializerRegistry);
return linqProvider.GetAdapter().TranslateExpressionToAggregateExpression(_expression, sourceSerializer, serializerRegistry, _translationOptions, contextData);
var contextData = _contextData?.With("SerializerRegistry", args.SerializerRegistry);
return args.LinqProvider.GetAdapter().TranslateExpressionToAggregateExpression(_expression, args.DocumentSerializer, args.SerializerRegistry, _translationOptions, contextData);
}
}

Expand Down Expand Up @@ -177,9 +188,9 @@ public DocumentsAggregateExpressionDefinition(

// public methods
/// <inheritdoc/>
public override BsonValue Render(IBsonSerializer<NoPipelineInput> sourceSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
public override BsonValue Render(RenderArgs<NoPipelineInput> args)
{
var documentSerializer = _documentSerializer ?? serializerRegistry.GetSerializer<TDocument>();
var documentSerializer = _documentSerializer ?? args.SerializerRegistry.GetSerializer<TDocument>();
return SerializationHelper.SerializeValues(documentSerializer, _documents);
}
}
Expand Down
19 changes: 15 additions & 4 deletions src/MongoDB.Driver/AggregateFacet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,25 @@ protected AggregateFacet(string name)
/// <param name="serializerRegistry">The serializer registry.</param>
/// <param name="linqProvider">The LINQ provider.</param>
/// <returns>The rendered pipeline.</returns>
public abstract BsonArray RenderPipeline(IBsonSerializer<TInput> inputSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider);
[Obsolete("Use Render(RenderArgs<TInput> args) overload instead.")]
public virtual BsonArray RenderPipeline(IBsonSerializer<TInput> inputSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
{
return RenderPipeline(new(inputSerializer, serializerRegistry, linqProvider));
}

/// <summary>
/// Renders the facet pipeline.
/// </summary>
/// <param name="args">The render arguments.</param>
/// <returns>A <see cref="BsonValue"/>.</returns>
public abstract BsonArray RenderPipeline(RenderArgs<TInput> args);
}

/// <summary>
/// Represents a facet to be passed to the Facet method.
/// </summary>
/// <typeparam name="TInput">The type of the input documents.</typeparam>
/// <typeparam name="TOutput">The type of the otuput documents.</typeparam>
/// <typeparam name="TOutput">The type of the output documents.</typeparam>
public class AggregateFacet<TInput, TOutput> : AggregateFacet<TInput>
{
/// <summary>
Expand All @@ -112,9 +123,9 @@ public AggregateFacet(string name, PipelineDefinition<TInput, TOutput> pipeline)
public PipelineDefinition<TInput, TOutput> Pipeline { get; private set; }

/// <inheritdoc/>
public override BsonArray RenderPipeline(IBsonSerializer<TInput> inputSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
public override BsonArray RenderPipeline(RenderArgs<TInput> args)
{
var renderedPipeline = Pipeline.Render(inputSerializer, serializerRegistry, linqProvider);
var renderedPipeline = Pipeline.Render(args);
return new BsonArray(renderedPipeline.Documents);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/ChangeStreamHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private static RenderedPipelineDefinition<TResult> RenderPipeline<TResult, TDocu
{
var changeStreamDocumentSerializer = new ChangeStreamDocumentSerializer<TDocument>(documentSerializer);
var serializerRegistry = BsonSerializer.GetSerializerRegistry();
return pipeline.Render(changeStreamDocumentSerializer, serializerRegistry, linqProvider);
return pipeline.Render(new(changeStreamDocumentSerializer, serializerRegistry, linqProvider));
}

private static void SetOperationOptions<TResult>(
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/ClusteredIndexOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public bool Unique
internal BsonDocument Render(IBsonSerializer<TDocument> documentSerializer, IBsonSerializerRegistry serializerRegistry)
{
return new BsonDocument {
{ "key", _key.Render(documentSerializer, serializerRegistry) },
{ "key", _key.Render(new(documentSerializer, serializerRegistry)) },
{ "unique", _unique },
{ "name", _name, _name != null }
};
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB.Driver/Encryption/ClientEncryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public async Task<BsonBinaryData> EncryptAsync(BsonValue value, EncryptOptions e
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The encrypted expression.</returns>
/// <remarks>
/// Only supported for queryType "rangePreview"
/// Only supported for queryType "range"
/// The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.
/// </remarks>
public BsonDocument EncryptExpression(BsonDocument expression, EncryptOptions encryptOptions, CancellationToken cancellationToken = default) =>
Expand All @@ -331,7 +331,7 @@ public BsonDocument EncryptExpression(BsonDocument expression, EncryptOptions en
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>the encrypted expression.</returns>
/// <remarks>
/// Only supported for queryType "rangePreview"
/// Only supported for queryType "range"
/// The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.
/// </remarks>
public async Task<BsonDocument> EncryptExpressionAsync(BsonDocument expression, EncryptOptions encryptOptions, CancellationToken cancellationToken = default) =>
Expand Down
Loading

0 comments on commit bafaef8

Please sign in to comment.