AspNetCore.HealthChecks.MongoDb 9.0.0

Prefix Reserved
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.
<PackageVersion Include="AspNetCore.HealthChecks.MongoDb" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" />
                    
Project file
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 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.
#addin nuget:?package=AspNetCore.HealthChecks.MongoDb&version=9.0.0
                    
Install AspNetCore.HealthChecks.MongoDb as a Cake Addin
#tool nuget:?package=AspNetCore.HealthChecks.MongoDb&version=9.0.0
                    
Install AspNetCore.HealthChecks.MongoDb as a Cake Tool

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.  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. 
.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 (62)

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 (20)

Showing the top 20 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-grade feature flag platform that you can self-host. Get started - free.
AlphaYu/adnc
.NET微服务/分布式开发框架,同时也适用于单体架构系统的开发。
Meowv/Blog
🤣本项目有不同开发版本,最新版底层基于 abp vNext 搭建和免费开源跨平台框架 .NET5 进行开发,使用 MongoDB 存储数据,Redis 缓存数据。项目采用前后端分离的模式进行开发,API 遵循 RESTful 接口规范,页面使用 Blazor 进行开发,可作为 .NET Core 入门项目进行学习。If you liked `Blog` project or if it helped you, please give a star ⭐️ for this repository. 👍👍👍
IoTSharp/IoTSharp
IoTSharp is an open-source IoT platform for data collection, processing, visualization, and device management.
meysamhadeli/monolith-to-cloud-architecture
A practical architecture styles for migrating from monolith to modern cloud native application with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq, and Masstransit in .Net 9.
mehdihadeli/food-delivery-microservices
🍔 A practical and imaginary food delivery microservices, built with .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
Aguafrommars/TheIdServer
OpenID/Connect, OAuth2, WS-Federation and SAML 2.0 server based on Duende IdentityServer and ITFoxtec Identity SAML 2.0 with its admin UI
streetwriters/notesnook-sync-server
Sync server for Notesnook (self-hosting in alpha)
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK.
fals/cqrs-clean-eventual-consistency
CQRS, using Clean Architecture, multiple databases and Eventual Consistency
jeangatto/ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing
ASP.NET Core, C#, CQRS Event Sourcing, REST API, DDD, SOLID Principles and Clean Architecture
mehdihadeli/food-delivery-modular-monolith
🌭 A practical and imaginary food and grocery delivery modular monolith, built with .Net 8, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
meysamhadeli/booking-modular-monolith
Practical Modular Monolith, built with .Net 9, DDD, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
Anapher/Strive
Open source video conferencing platform
ElectNewt/Distribt
vany0114/microservices-dotnetcore-docker-sf-k8s
Shows an approach to work with a microservices based architecture using .Net Core, Docker, and Azure Service Fabric/Kubernetes, applying Domain Driven Design (DDD) and Comand and Query Responsibility Segregation (CQRS) and other patterns.
aelassas/microservices
Microservices sample architecture using ASP.NET Core, Ocelot, MongoDB and JWT
Version Downloads Last updated
9.0.0 261,493 12/19/2024
8.1.0 1,026,589 8/28/2024
8.0.1 1,511,962 4/2/2024
8.0.0 942,799 12/15/2023
7.0.0 1,121,748 7/30/2023
7.0.0-rc2.6 39,186 3/13/2023
7.0.0-rc2.5 37,125 1/14/2023
7.0.0-rc2.4 796 12/27/2022
7.0.0-rc2.3 2,631 12/27/2022
6.0.2 7,427,924 2/28/2022
6.0.1 1,104,044 12/29/2021
6.0.1-rc2.2 23,351 11/10/2021
6.0.1-rc1.1 666 11/5/2021
6.0.0 44,059 12/29/2021
5.0.1 2,502,725 1/5/2021
5.0.0 58,442 12/29/2020
5.0.0-preview1 2,525 11/22/2020
3.1.3 1,572,252 10/22/2020
3.1.2 793,996 6/26/2020
3.1.1 447,017 4/17/2020
3.1.0 53,776 4/9/2020
3.0.1 1,007,673 10/14/2019
3.0.0 171,511 9/24/2019
2.2.3 585,560 6/26/2019
2.2.2 276,044 2/7/2019
2.2.1 38,596 12/20/2018
2.2.0 155,478 11/14/2018