diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 14c37164..59aba008 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -4,6 +4,13 @@ on:
pull_request:
branches: [ master ]
+env:
+ DOTNET_CLI_TELEMETRY_OPTOUT: true
+ DOTNET_NOLOGO: true
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
+ DOTNET_USE_POLLING_FILE_WATCHER: true
+ NUGET_XMLDOC_MODE: skip
+
jobs:
build:
@@ -11,10 +18,15 @@ jobs:
steps:
- uses: actions/checkout@v4
+ - name: Cache NuGet Packages
+ uses: actions/cache@v4
+ with:
+ key: nuget-cache
+ path: ~/.nuget/packages
- name: Setup .NET
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: 8.0.x
+ dotnet-version: 8
- name: Restore dependencies
run: dotnet restore ./src
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c245ae6d..f53022d2 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,9 +20,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup .NET
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
+ - name: Cache NuGet Packages
+ uses: actions/cache@v4
+ with:
+ key: nuget-cache
+ path: ~/.nuget/packages
- name: Restore dependencies
run: dotnet restore ./src
@@ -33,9 +38,8 @@ jobs:
- name: Test
run: dotnet test ./src -c Release --no-build --verbosity normal
-
- name: Create a Release
- uses: softprops/action-gh-release@v1
+ uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.event.inputs.version }}
diff --git a/src/Hangfire.Mongo.Sample.ASPNetCore/Hangfire.Mongo.Sample.ASPNetCore.csproj b/src/Hangfire.Mongo.Sample.ASPNetCore/Hangfire.Mongo.Sample.ASPNetCore.csproj
index 253b7632..6cef235b 100644
--- a/src/Hangfire.Mongo.Sample.ASPNetCore/Hangfire.Mongo.Sample.ASPNetCore.csproj
+++ b/src/Hangfire.Mongo.Sample.ASPNetCore/Hangfire.Mongo.Sample.ASPNetCore.csproj
@@ -23,9 +23,9 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Hangfire.Mongo.Sample.ASPNetCore/MongoRunner.cs b/src/Hangfire.Mongo.Sample.ASPNetCore/MongoRunner.cs
index 18e03dbd..886fe4b0 100644
--- a/src/Hangfire.Mongo.Sample.ASPNetCore/MongoRunner.cs
+++ b/src/Hangfire.Mongo.Sample.ASPNetCore/MongoRunner.cs
@@ -1,45 +1,27 @@
using System;
-using System.IO;
+using System.Threading.Tasks;
+using Testcontainers.MongoDb;
namespace Hangfire.Mongo.Sample.ASPNetCore
{
- public class MongoRunner : IDisposable
+ public class MongoTestRunner : IAsyncDisposable
{
- private Mongo2Go.MongoDbRunner _runner;
+ public readonly MongoDbContainer MongoDbContainer =
+ new MongoDbBuilder()
+ .WithImage("mongo:7.0")
+ .Build();
- public string ConnectionString => _runner?.ConnectionString;
- public MongoRunner Start()
- {
- var homePath = Environment.OSVersion.Platform is PlatformID.Unix or PlatformID.MacOSX
- ? Environment.GetEnvironmentVariable("HOME")
- : Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
-
- if (string.IsNullOrEmpty(homePath))
- {
- throw new InvalidOperationException("Could not locate home path");
- }
- var dataDir = Path.Combine(homePath, "mongodb", "data");
- for (int i = 0; i < 3; i++)
- {
- try
- {
- _runner = Mongo2Go.MongoDbRunner.StartForDebugging(
- singleNodeReplSet: true,
- dataDirectory: dataDir);
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- }
-
+ public string MongoConnectionString { get; private set; }
- return this;
+ public async Task Start()
+ {
+ await MongoDbContainer.StartAsync();
+ MongoConnectionString = MongoDbContainer.GetConnectionString();
}
- public void Dispose()
+ public async ValueTask DisposeAsync()
{
- _runner?.Dispose();
+ if (MongoDbContainer != null) await MongoDbContainer.DisposeAsync();
}
}
}
\ No newline at end of file
diff --git a/src/Hangfire.Mongo.Sample.ASPNetCore/MyRecurringjob.cs b/src/Hangfire.Mongo.Sample.ASPNetCore/MyRecurringjob.cs
index 04fb3912..429c98c8 100644
--- a/src/Hangfire.Mongo.Sample.ASPNetCore/MyRecurringjob.cs
+++ b/src/Hangfire.Mongo.Sample.ASPNetCore/MyRecurringjob.cs
@@ -1,5 +1,4 @@
using System;
-using System.Diagnostics;
using System.Threading;
namespace Hangfire.Mongo.Sample.ASPNetCore;
diff --git a/src/Hangfire.Mongo.Sample.ASPNetCore/Program.cs b/src/Hangfire.Mongo.Sample.ASPNetCore/Program.cs
index 0f0bf5a9..946c0c46 100755
--- a/src/Hangfire.Mongo.Sample.ASPNetCore/Program.cs
+++ b/src/Hangfire.Mongo.Sample.ASPNetCore/Program.cs
@@ -1,6 +1,5 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Logging;
namespace Hangfire.Mongo.Sample.ASPNetCore
{
diff --git a/src/Hangfire.Mongo.Sample.ASPNetCore/Startup.cs b/src/Hangfire.Mongo.Sample.ASPNetCore/Startup.cs
index 47f12b00..0c7031f8 100755
--- a/src/Hangfire.Mongo.Sample.ASPNetCore/Startup.cs
+++ b/src/Hangfire.Mongo.Sample.ASPNetCore/Startup.cs
@@ -30,14 +30,13 @@ public Startup(IHostEnvironment env)
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
- services.AddHangfire(config =>
+ services.AddHangfire(async config =>
{
-
- var runner = new MongoRunner().Start();
- services.AddSingleton(runner);
+ await using var mongoTestRunner = new MongoTestRunner();
+ await mongoTestRunner.Start();
// Read DefaultConnection string from appsettings.json
- var mongoUrlBuilder = new MongoUrlBuilder(runner.ConnectionString)
+ var mongoUrlBuilder = new MongoUrlBuilder(mongoTestRunner.MongoConnectionString)
{
DatabaseName = "hangfire"
};
diff --git a/src/Hangfire.Mongo.Sample.CosmosDB/Hangfire.Mongo.Sample.CosmosDB.csproj b/src/Hangfire.Mongo.Sample.CosmosDB/Hangfire.Mongo.Sample.CosmosDB.csproj
index 8f30a495..67f8d90b 100644
--- a/src/Hangfire.Mongo.Sample.CosmosDB/Hangfire.Mongo.Sample.CosmosDB.csproj
+++ b/src/Hangfire.Mongo.Sample.CosmosDB/Hangfire.Mongo.Sample.CosmosDB.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/src/Hangfire.Mongo.Sample.NETCore/Hangfire.Mongo.Sample.NETCore.csproj b/src/Hangfire.Mongo.Sample.NETCore/Hangfire.Mongo.Sample.NETCore.csproj
index e26ffbbe..716c7da0 100644
--- a/src/Hangfire.Mongo.Sample.NETCore/Hangfire.Mongo.Sample.NETCore.csproj
+++ b/src/Hangfire.Mongo.Sample.NETCore/Hangfire.Mongo.Sample.NETCore.csproj
@@ -19,7 +19,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Hangfire.Mongo.Sample.NETCore/MongoRunner.cs b/src/Hangfire.Mongo.Sample.NETCore/MongoRunner.cs
index 56682e09..288f0444 100644
--- a/src/Hangfire.Mongo.Sample.NETCore/MongoRunner.cs
+++ b/src/Hangfire.Mongo.Sample.NETCore/MongoRunner.cs
@@ -1,46 +1,27 @@
using System;
-using System.IO;
+using System.Threading.Tasks;
+using Testcontainers.MongoDb;
namespace Hangfire.Mongo.Sample.NETCore
{
- public class MongoRunner : IDisposable
+ public class MongoTestRunner : IAsyncDisposable
{
- private Mongo2Go.MongoDbRunner _runner;
+ public readonly MongoDbContainer MongoDbContainer =
+ new MongoDbBuilder()
+ .WithImage("mongo:7.0")
+ .Build();
- public string ConnectionString => _runner?.ConnectionString;
- public MongoRunner Start()
- {
- var homePath = Environment.OSVersion.Platform is PlatformID.Unix or PlatformID.MacOSX
- ? Environment.GetEnvironmentVariable("HOME")
- : Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
-
- if (string.IsNullOrEmpty(homePath))
- {
- throw new InvalidOperationException("Could not locate home path");
- }
- var dataDir = Path.Combine(homePath, "mongodb", "data");
- // try 3 times
- for (int i = 0; i < 3; i++)
- {
- try
- {
- _runner = Mongo2Go.MongoDbRunner.StartForDebugging(
- singleNodeReplSet: true,
- dataDirectory: dataDir);
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- }
-
+ public string MongoConnectionString { get; private set; }
- return this;
+ public async Task Start()
+ {
+ await MongoDbContainer.StartAsync();
+ MongoConnectionString = MongoDbContainer.GetConnectionString();
}
- public void Dispose()
+ public async ValueTask DisposeAsync()
{
- _runner?.Dispose();
+ if (MongoDbContainer != null) await MongoDbContainer.DisposeAsync();
}
}
}
\ No newline at end of file
diff --git a/src/Hangfire.Mongo.Sample.NETCore/Program.cs b/src/Hangfire.Mongo.Sample.NETCore/Program.cs
index 673054e2..6e00a606 100644
--- a/src/Hangfire.Mongo.Sample.NETCore/Program.cs
+++ b/src/Hangfire.Mongo.Sample.NETCore/Program.cs
@@ -1,8 +1,8 @@
using System;
+using System.Threading.Tasks;
using Hangfire.Logging.LogProviders;
using Hangfire.Mongo.Migration.Strategies;
using Hangfire.Mongo.Migration.Strategies.Backup;
-using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
namespace Hangfire.Mongo.Sample.NETCore
@@ -11,7 +11,7 @@ public class Program
{
private const int JobCount = 100;
- public static void Main()
+ public static async Task Main()
{
var migrationOptions = new MongoStorageOptions
{
@@ -24,10 +24,11 @@ public static void Main()
};
GlobalConfiguration.Configuration.UseLogProvider(new ColouredConsoleLogProvider());
- using var runner = new MongoRunner().Start();
-
+ await using var mongoTestRunner = new MongoTestRunner();
+ await mongoTestRunner.Start();
+
JobStorage.Current = new MongoStorage(
- MongoClientSettings.FromConnectionString(runner.ConnectionString),
+ MongoClientSettings.FromConnectionString(mongoTestRunner.MongoConnectionString),
databaseName: "Mongo-Hangfire-Sample-NETCore",
migrationOptions);
diff --git a/src/Hangfire.Mongo.Tests/ExpirationManagerFacts.cs b/src/Hangfire.Mongo.Tests/ExpirationManagerFacts.cs
index f6f9bfba..b091b36a 100644
--- a/src/Hangfire.Mongo.Tests/ExpirationManagerFacts.cs
+++ b/src/Hangfire.Mongo.Tests/ExpirationManagerFacts.cs
@@ -5,7 +5,6 @@
using Hangfire.Mongo.Dto;
using Hangfire.Mongo.Tests.Utils;
using MongoDB.Bson;
-using MongoDB.Driver;
using Xunit;
namespace Hangfire.Mongo.Tests
@@ -17,7 +16,7 @@ public class ExpirationManagerFacts : IDisposable
private readonly HangfireDbContext _dbContext;
private readonly CancellationToken _token;
- public ExpirationManagerFacts(MongoDbFixture fixture)
+ public ExpirationManagerFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_dbContext = fixture.CreateDbContext();
diff --git a/src/Hangfire.Mongo.Tests/Hangfire.Mongo.Tests.csproj b/src/Hangfire.Mongo.Tests/Hangfire.Mongo.Tests.csproj
index a9e91fe3..aac11c97 100644
--- a/src/Hangfire.Mongo.Tests/Hangfire.Mongo.Tests.csproj
+++ b/src/Hangfire.Mongo.Tests/Hangfire.Mongo.Tests.csproj
@@ -27,10 +27,10 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Hangfire.Mongo.Tests/Migration/Mongo/MigrationFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Mongo/MigrationFacts.cs
index 19f99f91..ad77ed5f 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Mongo/MigrationFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Mongo/MigrationFacts.cs
@@ -20,9 +20,9 @@ namespace Hangfire.Mongo.Tests.Migration.Mongo
[Collection("Database")]
public class MigrationFacts
{
- private readonly MongoDbFixture _fixture;
+ private readonly MongoIntegrationTestFixture _fixture;
- public MigrationFacts(MongoDbFixture fixture)
+ public MigrationFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_fixture = fixture;
diff --git a/src/Hangfire.Mongo.Tests/Migration/Mongo/MongoDatabaseFiller.cs b/src/Hangfire.Mongo.Tests/Migration/Mongo/MongoDatabaseFiller.cs
index bd775922..ff998d21 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Mongo/MongoDatabaseFiller.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Mongo/MongoDatabaseFiller.cs
@@ -19,9 +19,9 @@ namespace Hangfire.Mongo.Tests.Migration.Mongo
[Collection("Database")]
public class MongoDatabaseFiller
{
- private readonly MongoDbFixture _fixture;
+ private readonly MongoIntegrationTestFixture _fixture;
- public MongoDatabaseFiller(MongoDbFixture fixture)
+ public MongoDatabaseFiller(MongoIntegrationTestFixture fixture)
{
_fixture = fixture;
}
diff --git a/src/Hangfire.Mongo.Tests/Migration/Version15MigrationStepFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Version15MigrationStepFacts.cs
index 1188b57f..812f13b5 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Version15MigrationStepFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Version15MigrationStepFacts.cs
@@ -17,7 +17,7 @@ public class Version15MigrationStepFacts
private readonly HangfireDbContext _dbContext;
private readonly IMongoDatabase _database;
- public Version15MigrationStepFacts(MongoDbFixture fixture)
+ public Version15MigrationStepFacts(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
_database = _dbContext.Database;
diff --git a/src/Hangfire.Mongo.Tests/Migration/Version16MigrationStepFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Version16MigrationStepFacts.cs
index f6661a3b..3937615a 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Version16MigrationStepFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Version16MigrationStepFacts.cs
@@ -14,7 +14,7 @@ public class Version16MigrationStepFacts
private readonly HangfireDbContext _dbContext;
private readonly IMongoDatabase _database;
- public Version16MigrationStepFacts(MongoDbFixture fixture)
+ public Version16MigrationStepFacts(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
_database = _dbContext.Database;
diff --git a/src/Hangfire.Mongo.Tests/Migration/Version18MigrationStepFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Version18MigrationStepFacts.cs
index 50da3c0e..038dd77b 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Version18MigrationStepFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Version18MigrationStepFacts.cs
@@ -14,7 +14,7 @@ public class Version18MigrationStepFacts
{
private readonly IMongoDatabase _database;
- public Version18MigrationStepFacts(MongoDbFixture fixture)
+ public Version18MigrationStepFacts(MongoIntegrationTestFixture fixture)
{
var dbContext = fixture.CreateDbContext();
_database = dbContext.Database;
diff --git a/src/Hangfire.Mongo.Tests/Migration/Version19MigrationStepFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Version19MigrationStepFacts.cs
index 152336c6..0c1fa481 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Version19MigrationStepFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Version19MigrationStepFacts.cs
@@ -15,7 +15,7 @@ public class Version19MigrationStepFacts
private readonly IMongoDatabase _database;
private readonly Random _random;
private readonly AddTypeToSetDto _addTypeToSetDto;
- public Version19MigrationStepFacts(MongoDbFixture fixture)
+ public Version19MigrationStepFacts(MongoIntegrationTestFixture fixture)
{
var dbContext = fixture.CreateDbContext();
_database = dbContext.Database;
diff --git a/src/Hangfire.Mongo.Tests/Migration/Version20MigrationStepFacts.cs b/src/Hangfire.Mongo.Tests/Migration/Version20MigrationStepFacts.cs
index 2a298700..84e04a6b 100644
--- a/src/Hangfire.Mongo.Tests/Migration/Version20MigrationStepFacts.cs
+++ b/src/Hangfire.Mongo.Tests/Migration/Version20MigrationStepFacts.cs
@@ -16,7 +16,7 @@ public class Version20MigrationStepFacts
{
private readonly IMongoDatabase _database;
private readonly IMongoMigrationStep _migration;
- public Version20MigrationStepFacts(MongoDbFixture fixture)
+ public Version20MigrationStepFacts(MongoIntegrationTestFixture fixture)
{
var dbContext = fixture.CreateDbContext();
_database = dbContext.Database;
diff --git a/src/Hangfire.Mongo.Tests/MongoConnectionFacts.cs b/src/Hangfire.Mongo.Tests/MongoConnectionFacts.cs
index cb89766c..6d427dc8 100644
--- a/src/Hangfire.Mongo.Tests/MongoConnectionFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoConnectionFacts.cs
@@ -24,7 +24,7 @@ public class MongoConnectionFacts
private readonly MongoConnection _connection;
private readonly IJobQueueSemaphore _jobQueueSemaphoreMock;
- public MongoConnectionFacts(MongoDbFixture fixture)
+ public MongoConnectionFacts(MongoIntegrationTestFixture fixture)
{
_jobQueueSemaphoreMock = Substitute.For();
var storageOptions = new MongoStorageOptions
diff --git a/src/Hangfire.Mongo.Tests/MongoDiscriminatorTests.cs b/src/Hangfire.Mongo.Tests/MongoDiscriminatorTests.cs
index c460f395..c7d89134 100644
--- a/src/Hangfire.Mongo.Tests/MongoDiscriminatorTests.cs
+++ b/src/Hangfire.Mongo.Tests/MongoDiscriminatorTests.cs
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using Hangfire.Common;
using Hangfire.Mongo.Database;
using Hangfire.Mongo.Dto;
using Hangfire.Mongo.Tests.Utils;
using MongoDB.Bson;
-using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using Xunit;
@@ -19,7 +16,7 @@ public class MongoDiscriminatorTests
{
private readonly HangfireDbContext _dbContext;
- public MongoDiscriminatorTests(MongoDbFixture fixture)
+ public MongoDiscriminatorTests(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
}
diff --git a/src/Hangfire.Mongo.Tests/MongoDistributedLockFacts.cs b/src/Hangfire.Mongo.Tests/MongoDistributedLockFacts.cs
index 62d44a3f..2ff5a96e 100644
--- a/src/Hangfire.Mongo.Tests/MongoDistributedLockFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoDistributedLockFacts.cs
@@ -18,7 +18,7 @@ public class MongoDistributedLockFacts
{
private readonly HangfireDbContext _database;
- public MongoDistributedLockFacts(MongoDbFixture fixture)
+ public MongoDistributedLockFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_database = fixture.CreateDbContext();
diff --git a/src/Hangfire.Mongo.Tests/MongoFetchedJobFacts.cs b/src/Hangfire.Mongo.Tests/MongoFetchedJobFacts.cs
index d0950c6a..552a875c 100644
--- a/src/Hangfire.Mongo.Tests/MongoFetchedJobFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoFetchedJobFacts.cs
@@ -21,7 +21,7 @@ public class MongoFetchedJobFacts
private readonly DateTime _fetchedAt = DateTime.UtcNow;
private readonly HangfireDbContext _dbContext;
- public MongoFetchedJobFacts(MongoDbFixture fixture)
+ public MongoFetchedJobFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_dbContext = fixture.CreateDbContext();
diff --git a/src/Hangfire.Mongo.Tests/MongoJobQueueFacts.cs b/src/Hangfire.Mongo.Tests/MongoJobQueueFacts.cs
index 6b86fdad..349881a4 100644
--- a/src/Hangfire.Mongo.Tests/MongoJobQueueFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoJobQueueFacts.cs
@@ -19,7 +19,7 @@ public class MongoJobQueueFacts
private readonly IJobQueueSemaphore _jobQueueSemaphoreMock;
private readonly HangfireDbContext _hangfireDbContext;
- public MongoJobQueueFacts(MongoDbFixture fixture)
+ public MongoJobQueueFacts(MongoIntegrationTestFixture fixture)
{
_jobQueueSemaphoreMock = Substitute.For();
_jobQueueSemaphoreMock.WaitAny(DefaultQueues, default, default, out _, out _)
diff --git a/src/Hangfire.Mongo.Tests/MongoMonitoringApiFacts.cs b/src/Hangfire.Mongo.Tests/MongoMonitoringApiFacts.cs
index 7245a307..25d81dcc 100644
--- a/src/Hangfire.Mongo.Tests/MongoMonitoringApiFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoMonitoringApiFacts.cs
@@ -23,7 +23,7 @@ public class MongoMonitoringApiFacts
private readonly HangfireDbContext _database;
private readonly MongoMonitoringApi _monitoringApi;
- public MongoMonitoringApiFacts(MongoDbFixture fixture)
+ public MongoMonitoringApiFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_database = fixture.CreateDbContext();
diff --git a/src/Hangfire.Mongo.Tests/MongoNotificationObserverErrorFacts.cs b/src/Hangfire.Mongo.Tests/MongoNotificationObserverErrorFacts.cs
index 57e8296d..f520f3a0 100644
--- a/src/Hangfire.Mongo.Tests/MongoNotificationObserverErrorFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoNotificationObserverErrorFacts.cs
@@ -17,7 +17,7 @@ public sealed class MongoNotificationObserverErrorFacts : IDisposable
private readonly IJobQueueSemaphore _jobQueueSemaphoreMock;
private readonly CancellationTokenSource _cts;
- public MongoNotificationObserverErrorFacts(MongoDbFixture fixture)
+ public MongoNotificationObserverErrorFacts(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
_jobQueueSemaphoreMock = Substitute.For();
diff --git a/src/Hangfire.Mongo.Tests/MongoNotificationObserverFacts.cs b/src/Hangfire.Mongo.Tests/MongoNotificationObserverFacts.cs
index 38cb7ae9..76401092 100644
--- a/src/Hangfire.Mongo.Tests/MongoNotificationObserverFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoNotificationObserverFacts.cs
@@ -18,7 +18,7 @@ public sealed class MongoNotificationObserverFacts : IDisposable
private readonly IJobQueueSemaphore _jobQueueSemaphoreMock;
private readonly CancellationTokenSource _cts;
- public MongoNotificationObserverFacts(MongoDbFixture fixture)
+ public MongoNotificationObserverFacts(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
_jobQueueSemaphoreMock = Substitute.For();
diff --git a/src/Hangfire.Mongo.Tests/MongoRunServerFacts.cs b/src/Hangfire.Mongo.Tests/MongoRunServerFacts.cs
index aee3e2d9..e1064e2d 100644
--- a/src/Hangfire.Mongo.Tests/MongoRunServerFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoRunServerFacts.cs
@@ -38,7 +38,7 @@ public class MongoRunFixture : IDisposable
private readonly BackgroundJobServer _server;
public HangfireDbContext DbContext { get; }
- public MongoRunFixture(MongoDbFixture fixture)
+ public MongoRunFixture(MongoIntegrationTestFixture fixture)
{
var databaseName = "Mongo-Hangfire-CamelCase";
var context = fixture.CreateDbContext(databaseName);
diff --git a/src/Hangfire.Mongo.Tests/MongoStorageFacts.cs b/src/Hangfire.Mongo.Tests/MongoStorageFacts.cs
index da0a0c8a..9679cce8 100644
--- a/src/Hangfire.Mongo.Tests/MongoStorageFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoStorageFacts.cs
@@ -13,7 +13,7 @@ public class MongoStorageFacts
{
private readonly MongoStorage _storage;
- public MongoStorageFacts(MongoDbFixture fixture)
+ public MongoStorageFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_storage = fixture.CreateStorage();
diff --git a/src/Hangfire.Mongo.Tests/MongoVersionHelperFacts.cs b/src/Hangfire.Mongo.Tests/MongoVersionHelperFacts.cs
index 4eff56ab..b742812b 100644
--- a/src/Hangfire.Mongo.Tests/MongoVersionHelperFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoVersionHelperFacts.cs
@@ -12,9 +12,9 @@ namespace Hangfire.Mongo.Tests
[Collection("Database")]
public class MongoVersionHelperFacts
{
- private readonly MongoDbFixture _fixture;
+ private readonly MongoIntegrationTestFixture _fixture;
- public MongoVersionHelperFacts(MongoDbFixture fixture) => _fixture = fixture;
+ public MongoVersionHelperFacts(MongoIntegrationTestFixture fixture) => _fixture = fixture;
[Fact]
public void GetVersion_HasAdditionalInfo_Success()
diff --git a/src/Hangfire.Mongo.Tests/MongoWatcherFacts.cs b/src/Hangfire.Mongo.Tests/MongoWatcherFacts.cs
index 6d795bc9..d22f214d 100644
--- a/src/Hangfire.Mongo.Tests/MongoWatcherFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoWatcherFacts.cs
@@ -18,7 +18,7 @@ public sealed class MongoWatcherFacts : IDisposable
private readonly IJobQueueSemaphore _jobQueueSemaphoreMock;
private readonly CancellationTokenSource _cts;
- public MongoWatcherFacts(MongoDbFixture fixture)
+ public MongoWatcherFacts(MongoIntegrationTestFixture fixture)
{
_dbContext = fixture.CreateDbContext();
_jobQueueSemaphoreMock = Substitute.For();
@@ -66,7 +66,7 @@ public void Execute_JobEnqueued_Signaled()
[nameof(JobDto.Queue)] = "test"
}
});
- signal.Wait(100000);
+ signal.Wait(20000);
// ASSERT
_jobQueueSemaphoreMock.Received(1).Release("test");
diff --git a/src/Hangfire.Mongo.Tests/MongoWriteOnlyTransactionFacts.cs b/src/Hangfire.Mongo.Tests/MongoWriteOnlyTransactionFacts.cs
index 1de4ea0b..edc8faaf 100644
--- a/src/Hangfire.Mongo.Tests/MongoWriteOnlyTransactionFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MongoWriteOnlyTransactionFacts.cs
@@ -18,7 +18,7 @@ public class MongoWriteOnlyTransactionFacts
{
private readonly HangfireDbContext _database;
- public MongoWriteOnlyTransactionFacts(MongoDbFixture fixture)
+ public MongoWriteOnlyTransactionFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_database = fixture.CreateDbContext();
diff --git a/src/Hangfire.Mongo.Tests/MultipleServersFacts.cs b/src/Hangfire.Mongo.Tests/MultipleServersFacts.cs
index aedf9a6f..59880079 100644
--- a/src/Hangfire.Mongo.Tests/MultipleServersFacts.cs
+++ b/src/Hangfire.Mongo.Tests/MultipleServersFacts.cs
@@ -12,7 +12,7 @@ public class MultipleServersFacts
{
private readonly MongoStorage _storage;
- public MultipleServersFacts(MongoDbFixture fixture)
+ public MultipleServersFacts(MongoIntegrationTestFixture fixture)
{
fixture.CleanDatabase();
_storage = fixture.CreateStorage(new MongoStorageOptions { QueuePollInterval = TimeSpan.FromSeconds(1) });
diff --git a/src/Hangfire.Mongo.Tests/Utils/DatabaseCollection.cs b/src/Hangfire.Mongo.Tests/Utils/DatabaseCollection.cs
index 9317384d..4f89dc32 100644
--- a/src/Hangfire.Mongo.Tests/Utils/DatabaseCollection.cs
+++ b/src/Hangfire.Mongo.Tests/Utils/DatabaseCollection.cs
@@ -3,7 +3,7 @@
namespace Hangfire.Mongo.Tests.Utils
{
[CollectionDefinition("Database")]
- public class DatabaseCollection : ICollectionFixture
+ public class DatabaseCollection : ICollectionFixture
{
}
}
diff --git a/src/Hangfire.Mongo.Tests/Utils/MongoDbFixture.cs b/src/Hangfire.Mongo.Tests/Utils/MongoDbFixture.cs
index 3f1db145..882f4323 100644
--- a/src/Hangfire.Mongo.Tests/Utils/MongoDbFixture.cs
+++ b/src/Hangfire.Mongo.Tests/Utils/MongoDbFixture.cs
@@ -1,38 +1,37 @@
using System;
-using EphemeralMongo;
+using System.Threading.Tasks;
using Hangfire.Mongo.Database;
using Hangfire.Mongo.Migration.Strategies;
using Hangfire.Mongo.Migration.Strategies.Backup;
using MongoDB.Bson;
using MongoDB.Driver;
-using MongoDB.Driver.Linq;
-using Xunit.Abstractions;
-using Xunit.Sdk;
+using Testcontainers.MongoDb;
+using Xunit;
namespace Hangfire.Mongo.Tests.Utils;
-public sealed class MongoDbFixture : IDisposable
+public sealed class MongoIntegrationTestFixture : IAsyncLifetime
{
private const string DefaultDatabaseName = @"Hangfire-Mongo-Tests";
- private readonly IMongoRunner _runner;
+ public readonly MongoDbContainer MongoDbContainer =
+ new MongoDbBuilder()
+ .WithImage("mongo:7.0")
+ .Build();
- public MongoDbFixture(IMessageSink sink)
+ public string MongoConnectionString { get; private set; }
+
+ public async Task InitializeAsync()
{
- var options = new MongoRunnerOptions
- {
- //StandardOuputLogger = text => sink.OnMessage(new DiagnosticMessage(text)),
- StandardErrorLogger = text => sink.OnMessage(new DiagnosticMessage($"MongoDB ERROR: {text}")),
- UseSingleNodeReplicaSet = true
- };
- _runner = MongoRunner.Run(options);
+ await MongoDbContainer.StartAsync();
+
+ MongoConnectionString = MongoDbContainer.GetConnectionString();
}
- public void Dispose()
+ public async Task DisposeAsync()
{
- _runner.Dispose();
+ await MongoDbContainer.DisposeAsync();
}
-
public MongoStorage CreateStorage(string databaseName = null)
{
var storageOptions = new MongoStorageOptions
@@ -76,7 +75,7 @@ public void CleanDatabase(string dbName = null)
private MongoClient GetMongoClient()
{
- var settings = MongoClientSettings.FromConnectionString(_runner.ConnectionString);
+ var settings = MongoClientSettings.FromConnectionString(MongoConnectionString);
return new MongoClient(settings);
}
}
\ No newline at end of file
diff --git a/src/Hangfire.Mongo/CosmosDB/CosmosDbWriteOnlyTransaction.cs b/src/Hangfire.Mongo/CosmosDB/CosmosDbWriteOnlyTransaction.cs
index b729e588..7be9985d 100644
--- a/src/Hangfire.Mongo/CosmosDB/CosmosDbWriteOnlyTransaction.cs
+++ b/src/Hangfire.Mongo/CosmosDB/CosmosDbWriteOnlyTransaction.cs
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Hangfire.Common;
using Hangfire.Logging;
using Hangfire.Mongo.Database;
using Hangfire.Mongo.Dto;
-using Hangfire.Storage;
using MongoDB.Bson;
using MongoDB.Driver;
diff --git a/src/Hangfire.Mongo/CosmosDB/CosmosQueueWatcher.cs b/src/Hangfire.Mongo/CosmosDB/CosmosQueueWatcher.cs
index c1ddfc94..9a8c5e5b 100644
--- a/src/Hangfire.Mongo/CosmosDB/CosmosQueueWatcher.cs
+++ b/src/Hangfire.Mongo/CosmosDB/CosmosQueueWatcher.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Threading;
+using System.Threading;
using Hangfire.Logging;
using Hangfire.Mongo.Database;
using Hangfire.Mongo.Dto;
diff --git a/src/Hangfire.Mongo/Dto/ExpiringJobDto.cs b/src/Hangfire.Mongo/Dto/ExpiringJobDto.cs
index f0261087..e629dfbe 100644
--- a/src/Hangfire.Mongo/Dto/ExpiringJobDto.cs
+++ b/src/Hangfire.Mongo/Dto/ExpiringJobDto.cs
@@ -1,8 +1,5 @@
using System;
using MongoDB.Bson;
-using MongoDB.Bson.IO;
-using MongoDB.Bson.Serialization;
-using MongoDB.Bson.Serialization.Attributes;
namespace Hangfire.Mongo.Dto
{
diff --git a/src/Hangfire.Mongo/Dto/HashDto.cs b/src/Hangfire.Mongo/Dto/HashDto.cs
index a884401e..7fd75647 100644
--- a/src/Hangfire.Mongo/Dto/HashDto.cs
+++ b/src/Hangfire.Mongo/Dto/HashDto.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using MongoDB.Bson;
-using MongoDB.Bson.Serialization.Attributes;
namespace Hangfire.Mongo.Dto
{
diff --git a/src/Hangfire.Mongo/Dto/KeyJobDto.cs b/src/Hangfire.Mongo/Dto/KeyJobDto.cs
index aa08d7d5..644fcc42 100644
--- a/src/Hangfire.Mongo/Dto/KeyJobDto.cs
+++ b/src/Hangfire.Mongo/Dto/KeyJobDto.cs
@@ -1,5 +1,4 @@
using MongoDB.Bson;
-using MongoDB.Bson.Serialization.Attributes;
namespace Hangfire.Mongo.Dto
{
diff --git a/src/Hangfire.Mongo/Dto/MigrationLockDto.cs b/src/Hangfire.Mongo/Dto/MigrationLockDto.cs
index 37ad5e55..0cb8b923 100644
--- a/src/Hangfire.Mongo/Dto/MigrationLockDto.cs
+++ b/src/Hangfire.Mongo/Dto/MigrationLockDto.cs
@@ -1,6 +1,5 @@
using System;
using MongoDB.Bson;
-using MongoDB.Bson.Serialization.Attributes;
namespace Hangfire.Mongo.Dto
{
diff --git a/src/Hangfire.Mongo/Dto/SerializeExtensions.cs b/src/Hangfire.Mongo/Dto/SerializeExtensions.cs
index c017f83e..938046dd 100644
--- a/src/Hangfire.Mongo/Dto/SerializeExtensions.cs
+++ b/src/Hangfire.Mongo/Dto/SerializeExtensions.cs
@@ -1,7 +1,4 @@
using MongoDB.Bson;
-using System;
-using System.Collections.Generic;
-using System.Text;
namespace Hangfire.Mongo.Dto
{
diff --git a/src/Hangfire.Mongo/Hangfire.Mongo.csproj b/src/Hangfire.Mongo/Hangfire.Mongo.csproj
index f96388f4..3fe777f3 100644
--- a/src/Hangfire.Mongo/Hangfire.Mongo.csproj
+++ b/src/Hangfire.Mongo/Hangfire.Mongo.csproj
@@ -1,6 +1,7 @@
- netstandard2.0
+ netstandard2.1;net6.0;net8.0
+ net472;netstandard2.1;net6.0;net8.0
$(NoWarn);CS0618
true
true
@@ -11,8 +12,8 @@
Sergey Zwezdin, Jonas Gottschau
MongoDB storage implementation for Hangfire (background job system for ASP.NET applications).
Hangfire AspNet OWIN MongoDB CosmosDB Long-Running Background Fire-And-Forget Delayed Recurring Tasks Jobs Scheduler Threading Queues
- 1.10.9
- - Update to MongoDB 2.29.0
+ 1.11.0
+ - Update to MongoDB 3.0
README.md
@@ -25,7 +26,7 @@
-
+
diff --git a/src/Hangfire.Mongo/Migration/MigrationLock.cs b/src/Hangfire.Mongo/Migration/MigrationLock.cs
index 53bdebf2..3338363e 100644
--- a/src/Hangfire.Mongo/Migration/MigrationLock.cs
+++ b/src/Hangfire.Mongo/Migration/MigrationLock.cs
@@ -17,7 +17,7 @@ public sealed class MigrationLock : IDisposable
private readonly IMongoCollection _migrationLock;
private readonly BsonDocument _migrationIdFilter =
- new BsonDocument("_id", new BsonObjectId("5c351d07197a9bcdba4832fc"));
+ new BsonDocument("_id", new BsonObjectId(ObjectId.Parse("5c351d07197a9bcdba4832fc")));
///
/// ctor
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version07/01_EnqueuedJobMigration.cs b/src/Hangfire.Mongo/Migration/Steps/Version07/01_EnqueuedJobMigration.cs
index 56d641f1..90aa0583 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version07/01_EnqueuedJobMigration.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version07/01_EnqueuedJobMigration.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
+using System.Linq;
using MongoDB.Bson;
using MongoDB.Driver;
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version09/00_CreateSignalCollection.cs b/src/Hangfire.Mongo/Migration/Steps/Version09/00_CreateSignalCollection.cs
index 6be273d9..402e3f34 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version09/00_CreateSignalCollection.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version09/00_CreateSignalCollection.cs
@@ -1,5 +1,4 @@
-using Hangfire.Mongo.CosmosDB;
-using MongoDB.Driver;
+using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version09
{
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version13/00_CombineJobsAndStateData.cs b/src/Hangfire.Mongo/Migration/Steps/Version13/00_CombineJobsAndStateData.cs
index 22bceaa9..47515947 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version13/00_CombineJobsAndStateData.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version13/00_CombineJobsAndStateData.cs
@@ -1,8 +1,6 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Hangfire.Mongo.Dto;
using MongoDB.Bson;
using MongoDB.Driver;
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version15/03_RemoveMergedCounters.cs b/src/Hangfire.Mongo/Migration/Steps/Version15/03_RemoveMergedCounters.cs
index ebb63489..d3ab61d2 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version15/03_RemoveMergedCounters.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version15/03_RemoveMergedCounters.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using MongoDB.Bson;
using MongoDB.Driver;
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version17/00_AddNotificationsCollection.cs b/src/Hangfire.Mongo/Migration/Steps/Version17/00_AddNotificationsCollection.cs
index 0e515e15..88b19cdd 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version17/00_AddNotificationsCollection.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version17/00_AddNotificationsCollection.cs
@@ -1,4 +1,3 @@
-using Hangfire.Mongo.CosmosDB;
using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version17
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version20/01_CompoundIndexes.cs b/src/Hangfire.Mongo/Migration/Steps/Version20/01_CompoundIndexes.cs
index 8b6f7ccd..75b058ba 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version20/01_CompoundIndexes.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version20/01_CompoundIndexes.cs
@@ -1,5 +1,4 @@
-using System.Threading.Tasks;
-using MongoDB.Bson;
+using MongoDB.Bson;
using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version20
diff --git a/src/Hangfire.Mongo/Migration/Steps/Version21/00_AddIndexesMigration.cs b/src/Hangfire.Mongo/Migration/Steps/Version21/00_AddIndexesMigration.cs
index 9d25af7a..0bba6a54 100644
--- a/src/Hangfire.Mongo/Migration/Steps/Version21/00_AddIndexesMigration.cs
+++ b/src/Hangfire.Mongo/Migration/Steps/Version21/00_AddIndexesMigration.cs
@@ -1,7 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-using Hangfire.Mongo.Dto;
-using MongoDB.Bson;
+using MongoDB.Bson;
using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version21
diff --git a/src/Hangfire.Mongo/Migration/Strategies/Backup/NoneMongoBackupStrategy.cs b/src/Hangfire.Mongo/Migration/Strategies/Backup/NoneMongoBackupStrategy.cs
index 23fdb6f5..24a9008e 100644
--- a/src/Hangfire.Mongo/Migration/Strategies/Backup/NoneMongoBackupStrategy.cs
+++ b/src/Hangfire.Mongo/Migration/Strategies/Backup/NoneMongoBackupStrategy.cs
@@ -1,6 +1,4 @@
-using MongoDB.Driver;
-
-namespace Hangfire.Mongo.Migration.Strategies.Backup
+namespace Hangfire.Mongo.Migration.Strategies.Backup
{
///
/// No backup strategy
diff --git a/src/Hangfire.Mongo/MongoExpirationManager.cs b/src/Hangfire.Mongo/MongoExpirationManager.cs
index 0e590e76..1bd912f3 100644
--- a/src/Hangfire.Mongo/MongoExpirationManager.cs
+++ b/src/Hangfire.Mongo/MongoExpirationManager.cs
@@ -6,7 +6,6 @@
using Hangfire.Mongo.Migration;
using Hangfire.Server;
using MongoDB.Bson;
-using MongoDB.Driver;
namespace Hangfire.Mongo
{
diff --git a/src/Hangfire.Mongo/MongoWriteOnlyTransaction.cs b/src/Hangfire.Mongo/MongoWriteOnlyTransaction.cs
index 5e9fb785..16044c07 100644
--- a/src/Hangfire.Mongo/MongoWriteOnlyTransaction.cs
+++ b/src/Hangfire.Mongo/MongoWriteOnlyTransaction.cs
@@ -543,34 +543,34 @@ public virtual string SerializeWriteModel(WriteModel writeModel)
serializedDoc = ((InsertOneModel) writeModel).Document.ToJson();
break;
case WriteModelType.DeleteOne:
- serializedDoc = ((DeleteOneModel) writeModel).Filter.Render(serializer, registry)
+ serializedDoc = ((DeleteOneModel) writeModel).Filter.Render(new RenderArgs(serializer, registry))
.ToJson();
break;
case WriteModelType.DeleteMany:
- serializedDoc = ((DeleteManyModel) writeModel).Filter.Render(serializer, registry)
+ serializedDoc = ((DeleteManyModel) writeModel).Filter.Render(new RenderArgs(serializer, registry))
.ToJson();
break;
case WriteModelType.ReplaceOne:
serializedDoc = new Dictionary
{
- ["Filter"] = ((ReplaceOneModel) writeModel).Filter.Render(serializer, registry),
+ ["Filter"] = ((ReplaceOneModel) writeModel).Filter.Render(new RenderArgs(serializer, registry)),
["Replacement"] = ((ReplaceOneModel) writeModel).Replacement
}.ToJson();
break;
case WriteModelType.UpdateOne:
serializedDoc = new Dictionary
{
- ["Filter"] = ((UpdateOneModel) writeModel).Filter.Render(serializer, registry),
- ["Update"] = ((UpdateOneModel) writeModel).Update.Render(serializer, registry)
+ ["Filter"] = ((UpdateOneModel) writeModel).Filter.Render(new RenderArgs(serializer, registry)),
+ ["Update"] = ((UpdateOneModel) writeModel).Update.Render(new RenderArgs(serializer, registry))
.AsBsonDocument
}.ToJson();
break;
case WriteModelType.UpdateMany:
serializedDoc = new Dictionary
{
- ["Filter"] = ((UpdateManyModel) writeModel).Filter.Render(serializer, registry),
- ["Update"] = ((UpdateManyModel) writeModel).Update.Render(serializer, registry)
+ ["Filter"] = ((UpdateManyModel) writeModel).Filter.Render(new RenderArgs(serializer, registry)),
+ ["Update"] = ((UpdateManyModel) writeModel).Update.Render(new RenderArgs(serializer, registry))
.AsBsonDocument
}.ToJson();
break;