Rapidata.MongoDB.Migrations
2.1.1
dotnet add package Rapidata.MongoDB.Migrations --version 2.1.1
NuGet\Install-Package Rapidata.MongoDB.Migrations -Version 2.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rapidata.MongoDB.Migrations" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rapidata.MongoDB.Migrations" Version="2.1.1" />
<PackageReference Include="Rapidata.MongoDB.Migrations" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rapidata.MongoDB.Migrations --version 2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rapidata.MongoDB.Migrations, 2.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rapidata.MongoDB.Migrations@2.1.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rapidata.MongoDB.Migrations&version=2.1.1
#tool nuget:?package=Rapidata.MongoDB.Migrations&version=2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Rapidata.MongoDB.Migrations
A modern, thread-safe MongoDB migration engine for C#
Features
- 🔒 Thread-safe: Can be run by multiple services simultaneously
- 🔄 Guaranteed single execution for each migration
- 📚 Support for multiple database migrations
- ⚙️ Flexible configuration options
- 🚀 Easy integration with ASP.NET Core
Usage
Basic Usage
To get started, define the migrations in an assembly.
// Define a migration
public class TestMigration : IMigration
{
public DateOnly Date => new(2024, 10, 10);
public short Version => 1;
public string Name => "Test Migration";
public async Task Migrate(IMongoDatabase database, CancellationToken cancellationToken)
{
await database.CreateCollectionAsync(nameof(TestMigration), options: null, cancellationToken);
}
}
Then, register the migrations in the host and define at least one database to migrate.
// Register dependencies on the host
host.AddMongoDbMigrations(builder => builder.WithDatabase("default").WithMigrationsInAssemblyOfType<TestMigration>);
// Run the migrations
await host.MigrateMongoDb();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- MongoDB.Driver (>= 3.0.0)
-
net9.0
- MongoDB.Driver (>= 3.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rapidata.MongoDB.Migrations:
Package | Downloads |
---|---|
Rapidata.MongoDB.Migrations.AspNetCore
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.1.1 | 23,158 | 3/13/2025 |
2.1.0 | 11,946 | 12/2/2024 |
2.0.0 | 160 | 11/29/2024 |
1.0.0 | 3,848 | 11/21/2024 |
0.0.16 | 132 | 11/20/2024 |
0.0.15 | 124 | 11/20/2024 |
0.0.14 | 115 | 11/20/2024 |
0.0.13 | 114 | 11/20/2024 |
0.0.12 | 4,445 | 10/21/2024 |
0.0.11 | 4,782 | 9/13/2024 |
0.0.10 | 118 | 9/13/2024 |
0.0.9 | 159 | 9/13/2024 |
0.0.8 | 141 | 9/13/2024 |
0.0.7 | 129 | 9/13/2024 |
0.0.6 | 129 | 9/13/2024 |
0.0.5 | 136 | 9/13/2024 |
0.0.4 | 133 | 9/13/2024 |
0.0.3 | 132 | 9/13/2024 |
0.0.2 | 129 | 9/12/2024 |
0.0.1 | 138 | 9/12/2024 |