diff options
-rw-r--r-- | docs/guides/ecosystem/mongoose.md | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docs/guides/ecosystem/mongoose.md b/docs/guides/ecosystem/mongoose.md index a36bcd134..043ec4f22 100644 --- a/docs/guides/ecosystem/mongoose.md +++ b/docs/guides/ecosystem/mongoose.md @@ -33,11 +33,18 @@ const animalSchema = new mongoose.Schema( { name: {type: String, required: true}, sound: {type: String, required: true}, + }, + { + methods: { + speak() { + console.log(`${this.sound}!`); + }, + }, } ); export type Animal = mongoose.InferSchemaType<typeof animalSchema>; -export const Animal = mongoose.model('Kitten', animalSchema); +export const Animal = mongoose.model('Animal', animalSchema); ``` --- |