Fix mongoose ecosystem guid (#4740)

Fix missing method declaration on schema and Schema database name from Kitten to Animal
This commit is contained in:
Richard
2023-09-10 05:05:13 +03:00
committed by GitHub
parent e2d327881c
commit 6fe40f383a

View File

@@ -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);
```
---