Count Sequelize

Code Example - Count Sequelize

                
                        MyModel.count({
  include: ...,
  where: ...,
  distinct: true,
  col: 'Product.id'
})
.then(function(count) {
    // count is an integer
});
                    
                
 

sequelize count all

                        
                                Project.count().then(c => {
  console.log("There are " + c + " projects!")
})

Project.count({ where: {'id': {[Op.gt]: 25}} }).then(c => {
  console.log("There are " + c + " projects with an id greater than 25.")
})
                            
                        
 

Related code examples