0.1.1 • Published 3 years ago

@mongodb-helpers/health-check v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@mongodb-helpers/health-check


Build Status Coverage Status NPM version Code Size License

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)

License


MIT © Imed Jaberi