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
Hey,
I was going through your example of sequelize models. I am unable to understand how to write instance methods that require querying other models.
I have a doubt while writing the instance methods on a model. Let us assume there is a user model and a user has the option to create todos. Now a user can have many todos. How to write a function in the user models that returns the number of todos a user has. Example
instanceMethods: {countTodos: function(){// returns total number of todos of a user.}}
The text was updated successfully, but these errors were encountered:
Hey,
I was going through your example of sequelize models. I am unable to understand how to write instance methods that require querying other models.
I have a doubt while writing the instance methods on a model. Let us assume there is a
user model
and a user has the option to create todos. Now a user can have many todos. How to write a function in the user models that returns the number of todos a user has. ExampleThe text was updated successfully, but these errors were encountered: