You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there's some misunderstanding here. Model.discriminator() returns a model class (a class that inherits from mongoose.Model), not an instance of a model class. You're right that DocumentArray.discriminator() returns a constructor that is vaguely similar to a model.
I added a note to the docs about the return types.
Do you want to request a feature or report a bug?
docs / bug
What is the current behavior?
no return type is documented in https://github.com/Automattic/mongoose/blob/master/lib/schema/documentarray.js#L153
and it does not return an instance of
mongoose.Model
(what @types/mongoose suggests it does)If the current behavior is a bug, please provide the steps to reproduce.
look at the documentation, and
model.discriminator
returns a model andDocumentArray.discriminator
returns an constructor (that is not a model)?What is the expected behavior?
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
mongoose: 5.7.7
node: 12.13.0
mongo: 4.2-bionic (docker)
The text was updated successfully, but these errors were encountered: