File tree Expand file tree Collapse file tree
examples/06-mongoose/src/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Model } from 'mongoose' ;
22import { Component , Inject } from '@nestjs/common' ;
33import { Cat } from './interfaces/cat.interface' ;
4- import { CatsModule } from './cats.module' ;
54import { CreateCatDto } from './dto/create-cat.dto' ;
65
76@Component ( )
@@ -10,8 +9,8 @@ export class CatsService {
109 @Inject ( 'CatModelToken' ) private readonly catModel : Model < Cat > ) { }
1110
1211 async create ( createCatDto : CreateCatDto ) : Promise < Cat > {
13- const cat = new this . catModel ( createCatDto ) ;
14- return await cat . save ( ) ;
12+ const createdCat = new this . catModel ( createCatDto ) ;
13+ return await createdCat . save ( ) ;
1514 }
1615
1716 async findAll ( ) : Promise < Cat [ ] > {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as mongoose from 'mongoose';
33export const databaseProviders = [
44 {
55 provide : 'DbConnectionToken' ,
6- useFactory : async ( ) => {
6+ useFactory : async ( ) : Promise < mongoose . Connection > => {
77 ( mongoose as any ) . Promise = global . Promise ;
88 return await mongoose . connect ( 'mongodb://localhost/nest' , {
99 useMongoClient : true ,
You can’t perform that action at this time.
0 commit comments