Max and group by in Mongodb
问题 First of all we are just migrating from SQL Server to Mongodb. I have a collection containing fields TFN, Impressions . I need to transform the sql query in mongo but got stuck at a moment. Scenario is I need to select a top 5 impressions from the collection which are group by on the basis of tfns Select Top 5 a.TFN, a.MaxImpression as MaxCount from ( Select TFN, Max(Impressions) MaxImpression from tblData Where TFN in (Select TFN From @tmpTFNList) and TrendDate between @StartDate AND