User Report Tickets-Need Inputs

Hi ,

I have generated the necessary pipeline for User Report ticket in compass and correspondingly below is the code in CommentDao for the method mostActiveCommenters

List mostActive = new ArrayList<>();
List pipeline = new LinkedList<>();
Bson groupStage= Aggregates.group("$email", Accumulators.sum(“numComments”, 1));
Bson sort = Aggregates.sort(Sorts.descending(“numComments”));
Bson limit=Aggregates.limit(20);

pipeline.add(groupStage);
pipeline.add(sort);
pipeline.add(limit);

commentCollection.aggregate(pipeline);

I am not able to cast the result into List , can you pls provide some pointers to cast the result into a Critic list object. Or the approach being used needs to be changed?

Thanks

Hi @Sunil_55501,

You may need to create a different collection instance to return Critic Objects as mentioned in the code comments.
Also, think about how you can use withCodecRegistry with the Comments collection instance.

After all this, you will just need to perform the query on this result and move into mostActive list.

Kanika