UNPKG

@nestdevx/database

Version:

Database module designed to work with mongodb for multi-tenant NestJS applications.

42 lines (32 loc) 1 kB
# @nestdevx/database Database module designed to work with MongoDB for multi-tenant NestJS applications. ## Overview This package provides a database integration layer for multi-tenant NestJS projects using MongoDB and Mongoose. It is designed to be used as a shared library in your monorepo or as a standalone npm package. ## Installation ```bash npm install @nestdevx/database # or yarn add @nestdevx/database # or pnpm add @nestdevx/database ``` ## Usage Example Import the `DatabaseModule` into your feature or root module: ```typescript import { Module } from '@nestjs/common'; import { DatabaseModule } from '@nestdevx/database'; @Module({ imports: [ DatabaseModule.forMongoDbModels() // ... ], }) export class AppModule {} ``` You can add `DatabaseModule.forFeature([{ name: 'User', schema: UserSchema }])` in your feature modules to register models. ## Exports - `DatabaseModule` - `TENANT_CONNECTION` constant - Any additional helpers or decorators you add ## License MIT