dont know why its work ?😂
let result = await this.models.A.findAndCountAll({
where:{"id": A.id },
limit: per_page,
offset: page * per_page,
attributes: {
//include
exclude:['id','updatedAt','deletedAt']
},
order: [
[ { model: this.models.B, as: 'B' }, 'createdAt', 'DESC' ]
],
include:[{
model:this.models.B,
as:"B",
attributes: {
exclude:['id' ,'updatedAt','deletedAt']
},
required: true,
}],
});
i dont use count , A is counting B without group or count
are you sure you are getting the count of model B not of A?
tried your code.. I can't get it to work..also findAndCountAll selects everything and then count using JavaScript..so I don't see it's effectiveness as you can still select all data and output the array length
Обсуждают сегодня