@nestdevx/database
v1.0.3
Published
Database module designed to work with mongodb for multi-tenant NestJS applications.
Maintainers
Readme
@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
npm install @nestdevx/database
# or
yarn add @nestdevx/database
# or
pnpm add @nestdevx/databaseUsage Example
Import the DatabaseModule into your feature or root module:
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
DatabaseModuleTENANT_CONNECTIONconstant- Any additional helpers or decorators you add
License
MIT
