Chapter 4: Admin Backend Ticket: User report

Hi all,
I have successfully passed the “Ticket: User Report” using the command below:

var result = await _commentsCollection
                   .WithReadConcern(ReadConcern.Majority)
                   .Aggregate()
                   .Group(groupV)
                   .Sort(sortV).Limit(20).Project<ReportProjection>(projV).ToListAsync();

I had to cast the result to ReportProjection List because requsted by the method, so I have added just after “.Project”

If I wanted to use the aggregation code as generated by ATLAS/Compass, I woulld have to use:

var pipeline = PipelineDefinition<Comment, BsonDocument>.Create(filter);
var result= _commentCollection.Aggregate(pipeline).ToList();

How have I to casted result to be a ReportProjection List? No problem for the read concern.

Thanks for the help