From 6fe40f383af230ffade0a764bf25cbdb655db2af Mon Sep 17 00:00:00 2001 From: Richard <36774784+Fecony@users.noreply.github.com> Date: Sun, 10 Sep 2023 05:05:13 +0300 Subject: Fix mongoose ecosystem guid (#4740) Fix missing method declaration on schema and Schema database name from Kitten to Animal --- docs/guides/ecosystem/mongoose.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs/guides/ecosystem') 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; -export const Animal = mongoose.model('Kitten', animalSchema); +export const Animal = mongoose.model('Animal', animalSchema); ``` --- -- cgit v1.2.3