User Report question

It is not clear from the Ticket “User Report” and from comments in the most_active_commenters method in what format the result should be:

  1. simple list of user names
  2. user names and e-mails
  3. user names, e-mail and count of messages

Am I overthinking this?

Somewhat yes,

“As an administrator, I want to be able to view the top 20 users by their number of comments.”

How could we collect together the users with most comments, meaning we would have to count the number of comments by each user and then rank them, making sure we only get the top 20.

Hope the hint helps.

Look through the aggregation docs to help yourself further.
https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/#aggregation-pipeline-stages

1 Like

I have no problem to solve the ticket:

  1. You group comments by the user name OR by the e-mail and count the amount of comments
  2. sort them by count
  3. limit output by 20
  4. Optionally project name OR email and count

and you got your answer. The “OR” is what is bothering me. May be the Ticket could be more clear in this regard

1 Like

Use the email as ID for grouping, since it is the user’s single identifier, Names can be duplicated, emails cannot.