Sequelize: Class & Instance Methods

InstructorMike Frey

Share this video with your friends

Send Tweet

Models in the Node.js ORM, Sequelize, can be expanded with both class level and instance level functions. This video will show you how to extend your models to add helpers or business logic, and explain the methods execution scope.

Prith
~ 8 years ago

implementation wise, what's the difference between class methods and instance methods? As in, in what scenarios will we be using each of them?

Mike Freyinstructor
~ 8 years ago

Generally, if you want to act on a single instance, you'd create an instance method. If you want to act on multiple instances, such as, a method for helping query the database, you'd create a class method.