
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
AspNetCore.HealthChecks.MongoDb
Advanced tools
HealthChecks.MongoDb is the health check package for MongoDb.
This health check verifies the ability to communicate with MongoDB. It uses the provided MongoClient to list database names or ping configured database.
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();
}
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");
}
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.
FAQs
HealthChecks.MongoDb is the health check package for MongoDb.
We found that aspnetcore.healthchecks.mongodb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.