Chapter 4 - Ticket: User Report

result = await _commentsCollection
.WithReadConcern(new ReadConcern(ReadConcernLevel.Majority))
.Aggregate()
.Group( c=>c.Email, g => new { Id = g.Key, Count = result.Count})
.SortByDescending(g => g.Count)
.Limit(20)
.Project(p => new ReportProjection() { Id = p.Id, Count = p.Count }).ToListAsync();

Genearting exception as : Non-static method requires a target., did anybody face this?

Isue resolved, I made a mistake,

result = await _commentsCollection
.WithReadConcern(new ReadConcern(ReadConcernLevel.Available))
.Aggregate()
.Group( c=>c.Email, g => new { Id = g.Key, Count = g.Count()})
.SortByDescending(g => g.Count)
.Limit(20)
.Project(p => new ReportProjection() { Id = p.Id, Count = p.Count }).ToListAsync();