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 have searched existing issues to ensure the issue has not already been raised
Issue
I'm using mongoose 6.4.5, for reference.
When defining a model directly against the global mongoose reference, the type checking works perfectly fine. Here's an example lifted right out of your documentation:
If I look at the fluffy instance, I can properly see my schema:
I can also see the definition of the .save() method:
Now, when I'm trying to define a model against a specific connection (which to me, seems like a more likely situation people would be using this), the type checking does not work properly. Here's an example based on the first example:
If I look at my barky instance, my schema is not visible (type is "any"):
Which also means that the definition of the .save() method is also "any":
My current workaround is to take the type definition of model from node_modules\mongoose\types\index.d.ts and replace the definition of model in mongoose\types\connection.d.ts. This makes it work, but I'm sure it's not the proper way to do it.
The text was updated successfully, but these errors were encountered:
Prerequisites
Issue
I'm using mongoose 6.4.5, for reference.
When defining a model directly against the global mongoose reference, the type checking works perfectly fine. Here's an example lifted right out of your documentation:
If I look at the fluffy instance, I can properly see my schema:

I can also see the definition of the .save() method:

Now, when I'm trying to define a model against a specific connection (which to me, seems like a more likely situation people would be using this), the type checking does not work properly. Here's an example based on the first example:
If I look at my barky instance, my schema is not visible (type is "any"):

Which also means that the definition of the .save() method is also "any":

My current workaround is to take the type definition of model from node_modules\mongoose\types\index.d.ts and replace the definition of model in mongoose\types\connection.d.ts. This makes it work, but I'm sure it's not the proper way to do it.
The text was updated successfully, but these errors were encountered: