NexJob.MongoDB
5.4.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NexJob.MongoDB --version 5.4.1
NuGet\Install-Package NexJob.MongoDB -Version 5.4.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="NexJob.MongoDB" Version="5.4.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NexJob.MongoDB" Version="5.4.1" />
<PackageReference Include="NexJob.MongoDB" />
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 NexJob.MongoDB --version 5.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NexJob.MongoDB, 5.4.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 NexJob.MongoDB@5.4.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=NexJob.MongoDB&version=5.4.1
#tool nuget:?package=NexJob.MongoDB&version=5.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NexJob.MongoDB
MongoDB storage provider for NexJob — the background job scheduler for .NET 8+.
Backed by the official MongoDB.Driver, this provider uses FindOneAndUpdateAsync with atomic condition filters for concurrency-safe, lock-free job claiming across distributed workers.
Installation
dotnet add package NexJob.MongoDB
Quick Start
Register MongoDB storage in your dependency injection container before calling AddNexJob():
using NexJob;
using NexJob.MongoDB;
var builder = WebApplication.CreateBuilder(args);
// 1. Register MongoDB storage
builder.Services.AddNexJobMongoDB(
connectionString: builder.Configuration.GetConnectionString("MongoConnection")!,
databaseName: "nexjob");
// 2. Register NexJob core services
builder.Services.AddNexJob(options =>
{
options.Workers = 10;
options.Queues = ["default", "critical"];
});
Or provide a pre-configured IMongoDatabase:
var client = new MongoClient("mongodb://localhost:27017");
var database = client.GetDatabase("nexjob");
builder.Services.AddNexJobMongoDB(database);
Features
- Atomic State Transitions: Uses MongoDB
FindOneAndUpdatewith optimistic filter criteria (status: Enqueued) to prevent race conditions across multiple nodes without global locks. - Automatic Index Creation: Automatically builds compound and unique indexes on initialization for queues, priority, idempotency keys, and scheduled timestamps.
- Document-Oriented Storage: Flexible document schema for job arguments, execution metadata, and logs.
- Distributed Recurring Locks: Manages cron recurring job execution safely across replica sets using atomic collection locks (
nexjob_recurring_locks). - Runtime Settings Store: Persists dynamic queue limits and pause status in MongoDB.
Collections
The provider automatically manages the following collections in the target database:
| Collection | Purpose |
|---|---|
nexjob_jobs |
Job documents, input parameters, state transitions, retry attempts, and logs |
nexjob_recurring_jobs |
Recurring cron job schedules and execution tracking |
nexjob_recurring_locks |
Distributed locks for recurring job scheduling |
nexjob_servers |
Worker node heartbeats and cluster discovery |
nexjob_settings |
Dynamic queue configurations and runtime controls |
Connection String Example
{
"ConnectionStrings": {
"MongoConnection": "mongodb://user:secret@localhost:27017/?authSource=admin&replicaSet=rs0"
}
}
| 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 was computed. 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 (>= 2.30.0)
- NexJob (>= 5.4.1)
- SharpCompress (>= 0.48.0)
- Snappier (>= 1.3.1)
- System.Text.Encodings.Web (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.7.0 | 83 | 10/19/2026 |
| 6.6.0 | 91 | 10/18/2026 |
| 6.5.1 | 92 | 10/17/2026 |
| 6.5.0 | 90 | 10/17/2026 |
| 6.4.0 | 93 | 10/16/2026 |
| 6.3.0 | 79 | 10/12/2026 |
| 6.2.1 | 85 | 10/11/2026 |
| 6.2.0 | 95 | 10/10/2026 |
| 6.1.0 | 87 | 10/10/2026 |
| 6.0.0 | 92 | 10/9/2026 |
| 5.10.0 | 95 | 10/8/2026 |
| 5.9.0 | 93 | 10/5/2026 |
| 5.8.0 | 100 | 10/4/2026 |
| 5.7.0 | 91 | 10/1/2026 |
| 5.6.2 | 99 | 10/1/2026 |
| 5.6.1 | 102 | 9/30/2026 |
| 5.6.0 | 88 | 9/30/2026 |
| 5.5.0 | 97 | 9/25/2026 |
| 5.4.1 | 95 | 9/24/2026 |
| 5.4.0 | 98 | 9/24/2026 |
Loading failed