/typeorm-mongo-health

typeorm mongo health

Primary LanguageTypeScriptMIT LicenseMIT

Nest Logo

TypeOrm Mongo Health

Built with NestJS

A health checker for mongodb in typeorm

Table of contents

Installation

npm install --save typeorm-mongo-health

Usage

The simplest way to check mongo health in typeorm is using typeorm-mongo-health:

import { Injectable } from '@nestjs/common';
import { getConnection } from 'typeorm';
import { MongoHealh } from 'typeorm-mongo-health';

@Injectable()
export class HealthService {
  constructor(private mongoHelath: MongoHealh) {}

  async healthCheck(): Promise<any> {
    const mongoHealth = await this.mongoHelath.mongoHealth(
      getConnection(), // typeorm connection
      'mongodb-name', // mongo name
      10000, // timeout millisecond
    );
    return mongoHealth;
  }
}

Change Log

See Changelog for more information.

Contributing

Contributions welcome! See Contributing.

Author

Amir Kenarang (Amir Kenarang)

License

Licensed under the MIT License - see the LICENSE file for details.