IMongoQueryable GroupBy and Select SUM results in 0

22 Views Asked by At

Trying to get a grouped list with IMongoQueryable, the sum of the processingTimes (decimal) is always 0.

IMongoQueryable<RouteMonitor> query = (IMongoQueryable<RouteMonitor>)GetQueryable(filter);
return await query
   .GroupBy(monitor => monitor.RouteId)
   .Select(group => new RoutePerformanceReport(group.Key, group.Sum(g => g.ProcessingTime)))
   .ToListAsync();

Requesting a flat list of the document without GroupBy, the "performanceTime" is filled correctly. Is this a bug? Any Idea how I can handle this?

Min and Max (group.Min()) works as expected.

0

There are 0 best solutions below