Mongodb Joint Query Problem

  mongodb, question
class Subject(Document):
 '''
 News topic information
 '''
 Author _ ref = referencefield (account, dbref = false) # associated user
 when = DateTimeField(default=datetime.datetime.now, required=True)
 Title = stringfield (max _ length = 50) ` # article title

`

class Comment(Document):
 '''
 Comment
 '''
 Subject _ ref = referencefield (subject, dbref = false) # associated topic
 display_name = StringField(max_length=50)
 author_ref = ReferenceField(Account,dbref=False)
 Content = StringField() # content

Question: The first is the main post table and the second is the comment table. Now we need to query the list of main posts and count the number of comments of main posts.
Is there any good way?

Simply speaking, the demand in the library. The number of comments should have an additional field attribute in the main post. Why count every time? To have a post that is very popular and millions of comments, do you need to count?