所以目前我正在努力从我的查询中获得正确的结果。 下面是它的外观:
db.pitching.aggregate([
{ $match: {} },
{ $group: {
_id: "$playerid",
maxIpouts: { $max: "$ipouts" }
}}
])
我知道,我必须使用$match
,以获得正确的结果。我想得到一个单一的球员有最高($max
)ipouts,但我不知道如何筛选使用$match
。
没有$match
它给我的player_id
每个ipout的球员,而不是具有最高ipout
一个玩家ID。