A lightweight healthcheck function for Mongoose connections to MongoDB. Version 2.0.1 is the current stable release. It provides a simple synchronous check to determine if a Mongoose connection is ready, returning true if connected, false if not connected, or throwing an error on invalid input. It differs from more comprehensive healthcheck libraries by focusing solely on Mongoose and being minimal in dependencies. Release cadence is low; package has not been updated since 2019.
npm install mongo-healthcheckNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use mongo-healthcheck to check Mongoose connection state and return health status in an Express endpoint.
Ensure mongoose.connect() has completed before calling healthcheck.
Always pass a valid mongoose instance.
Use mongoose version 5.x or newer with unified topology.
Use const mongoHealthcheck = require('mongo-healthcheck');Use const mongoHealthcheck = require('mongo-healthcheck'); or import mongoHealthcheck from 'mongo-healthcheck';