@mongodb-helpers/health-check
v0.1.1
Published
Simple helper function for checking if your mongoose/mongodb connection to MongoDB is good
Downloads
6
Maintainers
Readme
@mongodb-helpers/health-check
Simple helper function for checking if your mongoose/mongodb connection to MongoDB is good 🪁.
Installation
# npm
$ npm install @mongodb-helpers/health-check mongodb
# yarn
$ yarn add @mongodb-helpers/health-check mongodb
When use mongoose should you also add mongoose
Usage
This is a practical example of how to use.
import { healthCheck } from "@mongodb-helpers/health-check";
const status = await healthCheck(MonogoDBorMongooseClient);
// 'Connected' | 'Disconnected'
// MonogoDBorMongooseClient:
// - mongodb: const client = await MongoClient.connect(MONGODB_URL)
// - mongoose: const client = await mongoose.connect(MONGODB_URL)