1.0.2 • Published 3 years ago

nestjs-mongodb-plus v1.0.2

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

nestjs-mongodb-plus

Simple NestJS module for MongoDB

Installation

npm i mongodb nestjs-mongodb-plus

Usage

// app.module.ts
@Module({
    imports: [MongoModule.forRoot("mongodb://...")]
})
export class AppModule {}
// cats.module.ts
...
@Module({
    imports: [
        MongoModule.forFeature({
            type: "collection",
            name: "cats"
        })
    ]
})
export class CatsModule
// cats.service.ts
@Injectable()
export class CatsService {
    constructor(
        @InjectCollection('cats') private readonly collection: Collection,
    ) {}
}

Collection interface is imported from the mongodb module.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago