AspNetCore.HealthChecks.MongoDb 9.0.0

dotnet add package AspNetCore.HealthChecks.MongoDb --version 9.0.0                
NuGet\Install-Package AspNetCore.HealthChecks.MongoDb -Version 9.0.0                
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="AspNetCore.HealthChecks.MongoDb" Version="9.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.HealthChecks.MongoDb --version 9.0.0                
#r "nuget: AspNetCore.HealthChecks.MongoDb, 9.0.0"                
#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.
// Install AspNetCore.HealthChecks.MongoDb as a Cake Addin
#addin nuget:?package=AspNetCore.HealthChecks.MongoDb&version=9.0.0

// Install AspNetCore.HealthChecks.MongoDb as a Cake Tool
#tool nuget:?package=AspNetCore.HealthChecks.MongoDb&version=9.0.0                

MongoDB Health Check

This health check verifies the ability to communicate with MongoDB. It uses the provided MongoClient to list database names or ping configured database.

Defaults

By default, the MongoClient instance is resolved from service provider.

void Configure(IHealthChecksBuilder builder)
{
    builder.Services
        .AddSingleton(sp => new MongoClient("mongodb://localhost:27017"))
        .AddHealthChecks()
        .AddMongoDb();
}

Customization

You can additionally add the following parameters:

  • clientFactory: A factory method to provide MongoClient instance.
  • databaseNameFactory: A factory method to provide database name.
  • name: The health check name. The default is mongodb.
  • failureStatus: The HealthStatus that should be reported when the health check fails. Default is HealthStatus.Unhealthy.
  • tags: A list of tags that can be used to filter sets of health checks.
  • timeout: A System.TimeSpan representing the timeout of the check.
void Configure(IHealthChecksBuilder builder)
{
    builder.Services
        .AddSingleton(sp => new MongoClient("mongodb://localhost:27017"))
        .AddHealthChecks()
        .AddMongoDb(databaseNameFactory: sp => "theName");
}

Breaking changes

MongoDbHealthCheck was letting the users specify how MongoClient should be created (from raw connection string or from MongoUrl or from MongoClientSettings), at a cost of maintaining an internal, static client instances cache. Now the type does not create client instances nor maintain an internal cache and it's the caller responsibility to provide the instance of MongoClient (please see #2048 for more details). Since MongoDB recommends treating clients as singletons and client instances can be expensive to create, it's recommended to register a singleton factory method for MongoClient. So the client is created only when needed and once per whole application lifetime.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (56)

Showing the top 5 NuGet packages that depend on AspNetCore.HealthChecks.MongoDb:

Package Downloads
Reo.Core.NoSql

Package Description

Reo.Core.AutoHistory

Package Description

Reo.Core.Database

Package Description

Reo.Core.Testing

Package Description

Reo.Core.Email

Package Description

GitHub repositories (19)

Showing the top 5 popular GitHub repositories that depend on AspNetCore.HealthChecks.MongoDb:

Repository Stars
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
dotnetcore/osharp
OSharp是一个基于.Net6.0的快速开发框架,框架对 AspNetCore 的配置、依赖注入、日志、缓存、实体框架、Mvc(WebApi)、身份认证、功能权限、数据权限等模块进行更高一级的自动化封装,并规范了一套业务实现的代码结构与操作流程,使 .Net 框架更易于应用到实际项目开发中。
grandnode/grandnode
Open source, headless, multi-tenant eCommerce platform built with .NET Core, MongoDB, AWS DocumentDB, Azure CosmosDB, Vue.js.
featbit/featbit
FeatBit provides open-source feature flag that you can self-host. Get started - free.
AlphaYu/adnc
.NET微服务/分布式开发框架,同时也适用于单体架构系统的开发。
Version Downloads Last updated
9.0.0 784 12/19/2024
8.1.0 485,070 8/28/2024
8.0.1 1,107,099 4/2/2024
8.0.0 764,698 12/15/2023
7.0.0 1,052,651 7/30/2023
7.0.0-rc2.6 36,013 3/13/2023
7.0.0-rc2.5 35,512 1/14/2023
7.0.0-rc2.4 748 12/27/2022
7.0.0-rc2.3 2,613 12/27/2022
6.0.2 7,102,411 2/28/2022
6.0.1 1,062,981 12/29/2021
6.0.1-rc2.2 22,551 11/10/2021
6.0.1-rc1.1 644 11/5/2021
6.0.0 37,984 12/29/2021
5.0.1 2,440,218 1/5/2021
5.0.0 55,512 12/29/2020
5.0.0-preview1 2,494 11/22/2020
3.1.3 1,540,464 10/22/2020
3.1.2 754,988 6/26/2020
3.1.1 439,019 4/17/2020
3.1.0 52,119 4/9/2020
3.0.1 992,030 10/14/2019
3.0.0 160,511 9/24/2019
2.2.3 574,838 6/26/2019
2.2.2 274,873 2/7/2019
2.2.1 38,438 12/20/2018
2.2.0 151,355 11/14/2018