所以目前我正在努力從我的查詢中獲得正確的結果。 下面是它的外觀:
db.pitching.aggregate([
{ $match: {} },
{ $group: {
_id: "$playerid",
maxIpouts: { $max: "$ipouts" }
}}
])
我知道,我必須使用$match
,以獲得正確的結果。我想得到一個單一的球員有最高($max
)ipouts,但我不知道如何篩選使用$match
。
沒有$match
它給我的player_id
每個ipout的球員,而不是具有最高ipout
一個玩家ID。