-
I could not find a way to test the return from example: const model = mongoose.connection.model('test', new mongoose.Schema());
console.log(model instanceof mongoose.Model); // false
console.log(model instanceof mongoose.connection.Model); // this property does not exist
console.log(model instanceof mongoose.connection.base.Model); // false |
Beta Was this translation helpful? Give feedback.
Answered by
vkarpov15
Aug 3, 2022
Replies: 1 comment 3 replies
-
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
hasezoey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mongoose.connection.model
returns a "class" that extends frommongoose.Model
, not an instance ofmongoose.Model
.console.log(Object.getPrototypeOf(model) === mongoose.Model); // true