Skip to content

Commit fc9f0fb

Browse files
Merge pull request #2684 from hyunjinjeong/patch-mongo-model
docs(mongo): change mongoose model type
2 parents b5676bf + 9b313ea commit fc9f0fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/techniques/mongo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ Once you've registered the schema, you can inject a `Cat` model into the `CatsSe
138138
import { Model } from 'mongoose';
139139
import { Injectable } from '@nestjs/common';
140140
import { InjectModel } from '@nestjs/mongoose';
141-
import { Cat, CatDocument } from './schemas/cat.schema';
141+
import { Cat } from './schemas/cat.schema';
142142
import { CreateCatDto } from './dto/create-cat.dto';
143143

144144
@Injectable()
145145
export class CatsService {
146-
constructor(@InjectModel(Cat.name) private catModel: Model<CatDocument>) {}
146+
constructor(@InjectModel(Cat.name) private catModel: Model<Cat>) {}
147147

148148
async create(createCatDto: CreateCatDto): Promise<Cat> {
149149
const createdCat = new this.catModel(createCatDto);
@@ -259,7 +259,7 @@ If you are just looking to inject the model from a named database, you can use t
259259
@@filename(cats.service)
260260
@Injectable()
261261
export class CatsService {
262-
constructor(@InjectModel(Cat.name, 'cats') private catModel: Model<CatDocument>) {}
262+
constructor(@InjectModel(Cat.name, 'cats') private catModel: Model<Cat>) {}
263263
}
264264
@@switch
265265
@Injectable()

0 commit comments

Comments
 (0)