0

My model classes are: Post, Comment (Post has a one-to-many relation with Comment).

I want to query the count of comments on a post. So I am querying get Post and joining Comment, but I can't get joined comment's full entity length.

How do I get count of joined entity? I am thinking of the findAndCountAll method, but this is getting the count of Post instead.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
June Lee
  • 357
  • 5
  • 16
  • 1
    Could you please share some code of what you have currently? – Rodrigo Rodrigues May 20 '19 at 16:01
  • I would advice to include some code you tried into your post. It will increase the chances of getting an answer and reduce the chances of having your question flagged and removed. – acarlstein May 20 '19 at 16:01
  • Possible duplicate of : https://stackoverflow.com/questions/37817808/counting-associated-entries-with-sequelize – Flo May 20 '19 at 16:08

0 Answers0