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
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="9.0.0" />
paket add AspNetCore.HealthChecks.MongoDb --version 9.0.0
#r "nuget: AspNetCore.HealthChecks.MongoDb, 9.0.0"
// 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 provideMongoClient
instance.databaseNameFactory
: A factory method to provide database name.name
: The health check name. The default ismongodb
.failureStatus
: TheHealthStatus
that should be reported when the health check fails. Default isHealthStatus.Unhealthy
.tags
: A list of tags that can be used to filter sets of health checks.timeout
: ASystem.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 | Versions 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. |
-
.NETFramework 4.7.2
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.11)
- MongoDB.Driver (>= 3.0.0)
-
.NETStandard 2.1
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.11)
- MongoDB.Driver (>= 3.0.0)
-
net8.0
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.11)
- MongoDB.Driver (>= 3.0.0)
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
Enterprise-level feature flag platform that you can self-host. Get started - free.
|
|
AlphaYu/adnc
.NET微服务/分布式开发框架,同时也适用于单体架构系统的开发。
|
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 959 | 12/19/2024 |
8.1.0 | 486,397 | 8/28/2024 |
8.0.1 | 1,107,935 | 4/2/2024 |
8.0.0 | 764,892 | 12/15/2023 |
7.0.0 | 1,052,800 | 7/30/2023 |
7.0.0-rc2.6 | 36,015 | 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,103,879 | 2/28/2022 |
6.0.1 | 1,062,997 | 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,987 | 12/29/2021 |
5.0.1 | 2,440,321 | 1/5/2021 |
5.0.0 | 55,514 | 12/29/2020 |
5.0.0-preview1 | 2,494 | 11/22/2020 |
3.1.3 | 1,540,502 | 10/22/2020 |
3.1.2 | 755,023 | 6/26/2020 |
3.1.1 | 439,036 | 4/17/2020 |
3.1.0 | 52,121 | 4/9/2020 |
3.0.1 | 992,067 | 10/14/2019 |
3.0.0 | 160,533 | 9/24/2019 |
2.2.3 | 574,856 | 6/26/2019 |
2.2.2 | 274,875 | 2/7/2019 |
2.2.1 | 38,438 | 12/20/2018 |
2.2.0 | 151,358 | 11/14/2018 |