1
の最大値を持つ文書を見つけ、私は中間結果を持っているような:MongoDBは私のaggreagateパイプラインでリラックス実行した後に特定のフィールド(ARGMAX)
[
{_id:1, precision:0.91, recall:0.71, other fields...},
{_id:1, precision:0.71, recall:0.81, other fields...},
{_id:1, precision:0.61, recall:0.91, other fields...},
{_id:2, precision:0.82, recall:0.42, other fields...},
{_id:2, precision:0.72, recall:0.52, other fields...},
{_id:2, precision:0.62, recall:0.62, other fields...}
]
今私は_idでグループ文書をしたいと思い、各グループで、最大のリコールを持つ文書を見つけ、この文書のリコール、precison、および_idを取得します。
だから、結果は次のようになります。
[
{_id:1, precisionOfDocWithMaxRecall:0.61, maxRecall:0.91},
{_id:2, precisionOfDocWithMaxRecall:0.62, maxRecall:0.62}
]
私はグループを使用して結果を得るために管理し、最大なく、精度のフィールドなしています。