Skip to content
Advertisement

Sequelize – How to get reviews for post with likes count for each review

I have a function like this. It receives comments on the post. And it doesn’t work – it makes endless requests.

If we remove this line, the function returns one comment with counted likes.

And if you remove this block:

… then the function will return an ARRAY of comments. Why does the like counting make only one comment come back?

How to get an array of reviews with counted likes? Here is the nesting function:

endless query strings while full code:

without nested:

without include: [[db.Sequelize.fn("COUNT"...:

Advertisement

Answer

Try adding group by to reviews

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement