Trying to figure out this User Report ticket. here is my current code:
var filter = Builders<BsonDocument>.Projection
.Include("count")
.Exclude("_id");
result = await _commentsCollection
.WithReadConcern(ReadConcern.Majority)
.Aggregate()
.Group(new BsonDocument
{
{ "id", "$email" },
{"count",
new BsonDocument ("$sum", 1)}
})
.Sort(new BsonDocument("count", -1))
.Limit(20)
.Project<ReportProjection>(filter)
.ToListAsync();
I think I need to use a Bson document instead of a builder for the projection, but am not sure how to do that. Any guidance welcome!